c++ - GCC编译器错误: -Werror=stringop-truncation: no option

标签 c++ cmake avr-gcc

我正在尝试运行 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/

相关文章:

c - 如何防止 GCC 优化繁忙的等待循环?

c - avr-gcc 编译器优化了全局变量

c++ - 让 svn diff 在提交期间显示 C++ 函数

c++ - 将字节写入文件

c++ - MinGW/CMake 对 ZLib 的 undefined reference

build - 递归 CMake 搜索头文件和源文件

c - 在 C 中使用 printf_P 右对齐

c++ - unordered_multimap<string, string> 到 map<string, string> 软搜索,如何做这样的事情以及如何预处理 map 以加快搜索速度?

c# - 如何从 C# 调用 SLGetWindowsInformation

python - OS X cmake 找不到 PythonLibs 3.4