-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to use C++ Standard Library #15603
Comments
Is this a reasonable fix or am I oversimplifying? diff --git a/cmake/compiler/gcc/target_baremetal.cmake b/cmake/compiler/gcc/target_baremetal.cmake
index d268604435..0c657a61ac 100644
--- a/cmake/compiler/gcc/target_baremetal.cmake
+++ b/cmake/compiler/gcc/target_baremetal.cmake
@@ -5,7 +5,8 @@ macro(toolchain_cc_nostdinc)
if (NOT CONFIG_NEWLIB_LIBC AND
NOT COMPILER STREQUAL "xcc" AND
- NOT CONFIG_NATIVE_APPLICATION)
+ NOT CONFIG_NATIVE_APPLICATION AND
+ NOT CONFIG_CPLUSPLUS)
zephyr_compile_options( -nostdinc)
zephyr_system_include_directories(${NOSTDINC})
endif() |
@SebastianBoe could you please take a look at this one? |
Presumably, this is due to NOSTDINC not pointing to the correct directory, but I am unable to figure out how to set it correctly, so avoiding -nostdinc is OK. |
Take a look at the PR here and discussion, we might need to resurrect this: |
The reporter has not enabled CONFIG_NEWLIB_LIBC. To use the C++ standard library the CONFIG_LIB_CPLUSPLUS option must be enabled. And to enable CONFIG_LIB_CPLUSPLUS, the CONFIG_NEWLIB_LIBC option must be enabled. A dependency that enforces this will be added in #18224 |
Backport is now in branch. |
Describe the bug
C++ Standard Library cannot be used with Zephyr 1.14.0. It used to work with 1.14-rc1.
To Reproduce
prj.conf:
CONFIG_CPLUSPLUS=y
main.cpp:
Command line:
D:\zephyr-test>cmake -GNinja -Bbuild -H. -DBOARD=stm32f4_disco && ninja -C build
Output:
Expected behavior
It compiles, as with 1.14-rc1:
Impact
Cannot update to Zephyr 1.14.0 for current development project.
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: