Compiling error in C++

I am using download_client library in C++ project. I have to include coap.h but when I compile I get this error:


C:/ncs/v2.7.0/zephyr/include/zephyr/net/coap.h:744:16: error: invalid conversion from 'int' to 'coap_block_size' [-fpermissive]

I can modify my CMakeLists.txt adding the following

target_compile_options(app PRIVATE -fpermissive)
but my question is if exists one way to compile without downgrading c++ checks.
Best Regards
  • Hi,

    I am using download_client library in C++ project. I have to include coap.h

    Can you show how you do this?

    when I compile I get this error:


    C:/ncs/v2.7.0/zephyr/include/zephyr/net/coap.h:744:16: error: invalid conversion from 'int' to 'coap_block_size' [-fpermissive]

    Can you provide full log which shows the error?

    my question is if exists one way to compile without downgrading c++ checks.

    Can you rephrase this sentence? What do you refer to as "downgrading C++ checks"?

    Which C++ version do you use?

    Best regards,
    Dejan

  • C++ version 12.2.0

    As full log, do you mean this?:


    In file included from C:/ncs/modem_and_sensor/src/ClientLibrary/CDownloadClient.h:5,
    from C:/ncs/modem_and_sensor/src/ClientLibrary/CDownloadClient.cpp:1:
    C:/ncs/v2.7.0/zephyr/include/zephyr/net/coap.h: In function 'coap_block_size coap_bytes_to_block_size(uint16_t)':
    C:/ncs/v2.7.0/zephyr/include/zephyr/net/coap.h:744:16: error: invalid conversion from 'int' to 'coap_block_size' [-fpermissive]
    744 | return sz;


    Adding this in my CMakeLists.txt

    target_compile_options(app PRIVATE -fpermissive)
    the error becomes a warning, so I downgrade an error to a simple warning.

Related