GCC编译器错误:-Werror = stringop-truncation:无选项

问题描述 投票:0回答:1

我正在尝试运行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),所以我不知道为什么它试图截断字符串。我什至已注释掉整个文件,但它仍在寻找某些东西。我在哪里可以找到解决方案?

c++ cmake avr-gcc
1个回答
0
投票

我什至在文件中都没有包含字符串(CLed.cpp),所以我不知道为什么它试图截断字符串

不是“试图截断字符串”,也不是警告“试图截断字符串”。

错误是说,编译器无法识别警告选项,但编译器获得了选项-Werror=stringop-truncation。解决方案是不将-Werror=stringop-truncation传递给编译器。或使用另一个支持该选项的编译器(版本)。

© www.soinside.com 2019 - 2024. All rights reserved.