Hi,
I'm not sure if SES support C++ compiler in nRF9160 project, I did add C++ source in CMakeList:
target_sources(app PRIVATE src/xxx.cpp)
It won't work, Does anyone know?
Thanks,
Bertie
Hi,
I'm not sure if SES support C++ compiler in nRF9160 project, I did add C++ source in CMakeList:
target_sources(app PRIVATE src/xxx.cpp)
It won't work, Does anyone know?
Thanks,
Bertie
Hi.
Did you enable C++ support using CONFIG_CPLUSPLUS and CONFIG_LIB_CPLUSPLUS?
Have you tried building from the command line (you will have to set two environment variables first: ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb and GNUARMEMB_TOOLCHAIN_PATH=<path to your toolchain install directory>)?
While C++ should be supported in NCS, I do not believe it is much tested, so you are largely on your own.
Best regards,
Didrik
Thanks Didrik,
I added CONFIG_CPLUSPLUS=y and CONFIG_LIB_CPLUSPLUS=y in prj.conf
built it on Window SES. Project can be built but just not compile the .cpp file which is in CMakeLists.
what I tested is to use "hello world" in zephyr\samples\hello_world:
changed src/main.c to src/main.cpp, also in CMakeLists
added CONFIG_CPLUSPLUS=y and CONFIG_LIB_CPLUSPLUS=y in prj.conf
Loaded project into SES, and the main.cpp is not in Project 'app/libapp.a' list, but main.c was there before modification:
build and run on nRF9160 DK board won't print "hello world" on terminal as main.c build does.
Did I miss something?
Thanks
I just tried myself, and it does indeed look like SES has some problems with C++.
However, the attached project worked fine when building from the command line.
Note that I had to disable (or rather, not set) CONFIG_LIB_CPLUSPLUS to make it compile.
Command line works, thank you.
do you know what is the problem of SES with C++? Command line build is not so convenient for us.
Hi, and sorry for the slow response.
We do not have official C++ support in any of our SDKs, so you are mostly on your own here.
Best regards,
Didrik