这个问题指的是手臂-无eabi-g++ 6.2,并链接到newlib-nano。
当我使用C源对-specs=nano.specs进行预处理时,包含来自目录newlib-nano的文件newlib.h:
echo '#include <string.h>' |\
/opt/gcc-arm-none-eabi-6_2-2016q4/bin/arm-none-eabi-gcc -specs=nano.specs -x c -E - |\
grep '^# 1 .*newlib\.h'输出# 1 "/opt/gcc-arm-none-eabi-6_2-2016q4/arm-none-eabi/include/newlib-nano/newlib.h" 1 3 4 (如预期的)。这是因为文件nano.specs包含(除其他外)行
%rename cpp nano_cpp
*cpp:
-isystem =/include/newlib-nano %(nano_cpp)但是,如果我通过同一个编译器向C++源提供数据
echo '#include <string.h>' |\
/opt/gcc-arm-none-eabi-6_2-2016q4/bin/arm-none-eabi-gcc -specs=nano.specs -x c++ -E - |\
grep '^# 1 .*newlib\.h'输出读取# 1 "/opt/gcc-arm-none-eabi-6_2-2016q4/arm-none-eabi/include/newlib.h" 1 3。
换句话说,规范文件被忽略了。
我知道我应该将<cstring>而不是<string.h>包含在C++源代码中,GNU g++通常是由…/arm-none-eabi-c++而不是…/arm-none-eabi-gcc -x c++调用的,但我这样做是为了消除细微的差异。这并没有改变这件事。
问题:我需要在规范文件中添加什么才能让C++文件包括newlib-nano/newlib.h
发布于 2017-02-13 16:03:46
这是一个bug (https://bugs.launchpad.net/gcc-arm-embedded/+bug/1661882)。已经修好了。这将在“6-2017-Q1-更新”中进行。
https://stackoverflow.com/questions/41535795
复制相似问题