我正在尝试运行 gcc 编译器来生成可执行文件,但每当我在终端中运行“make”命令时都会收到此消息:
Scanning dependencies of target my_libs-atmega328p
[ 2%] Building CXX object my_libs/CMakeFiles/my_libs-atmega328p.dir/CLed.cpp.obj
cc1plus: error: -Werror=stringop-truncation: no option -Wstringop-truncation
make[2]: *** [my_libs/CMakeFiles/my_libs-atmega328p.dir/build.make:63:my_libs/CMakeFiles/my_libs-atmega328p.dir/CLed.cpp.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:246: my_libs/CMakeFiles/my_libs-atmega328p.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
我什至在它被绊倒的文件(CLed.cpp)中没有字符串,所以我不知道为什么它试图截断字符串。我什至已经注释掉了整个文件,但它仍然在寻找一些东西。我可以去哪里寻找解决方案?
最佳答案
I don't even have a string in the file it gets tripped up on (CLed.cpp), so I don't know why it is trying to truncate a string
它不是“尝试截断字符串”,也不是关于“尝试截断字符串”的警告。
该错误表明编译器被赋予了选项-Werror=stringop-truncation
,而编译器无法识别此类警告选项。解决方案是不将 -Werror=stringop-truncation
传递给编译器。或者使用另一个支持此类选项的编译器(版本)。
关于c++ - GCC编译器错误: -Werror=stringop-truncation: no option,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61900438/