问题描述
我有一个C ++项目,该项目在x86 Linux和Windows上使用gcc 7.2可以正常构建并且没有警告,我需要将其移植到ARM设备,因此我尝试使用"arm-linux-gnueabihf" gcc 7.2对其进行交叉编译.在我的x86机器上运行,它可以构建,但是我收到很多此类警告
I have a C++ project that builds fine and without warnings with gcc 7.2 on x86 Linux and Windows, I needed to port it to an ARM device so I tried to crosscompile it with an "arm-linux-gnueabihf" gcc 7.2 that runs on my x86 machine, it builds but I get a lot of warnings of this kind
note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<P2d*, std::vector<P2d> >' changed in GCC 7.1
_M_realloc_insert(end(), __x);
和
/opt/armv7-gcc-2017/arm-linux-gnueabihf/include/c++/7.2.0/bits/vector.tcc:105:21: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<cpzparser::Anchor*, std::vector<cpzparser::Anchor> >' changed in GCC 7.1
_M_realloc_insert(end(), std::forward<_Args>(__args)...);
或
/opt/armv7-gcc-2017/arm-linux-gnueabihf/include/c++/7.2.0/bits/vector.tcc:394:7: note: parameter passing for argument of type 'std::vector<cpzparser::PointEntity>::iterator {aka __gnu_cxx::__normal_iterator<cpzparser::PointEntity*, std::vector<cpzparser::PointEntity> >}' changed in GCC 7.1
vector<_Tp, _Alloc>::
生成的可执行文件似乎运行良好,但是我担心所有这些警告的存在,因为我不知道它们是什么意思.
the generated executable seems to work fine but I am worried by the presence of all those warnings since I have no idea of what they mean.. any clue?
推荐答案
该警告告诉您6和7.1之间存在微妙的ABI更改(实际上是一致性修复),例如,使用6.x或更早版本构建的库从使用7.x构建的代码中调用时可能无法正常工作(反之亦然).只要所有C ++代码都是使用GCC 7.1或更高版本构建的,您就可以安全地忽略此警告.要禁用它,请将-Wno-psabi
传递给编译器.
That warning is telling you that there was a subtle ABI change (actually a conformance fix) between 6 and 7.1, such that libraries built with 6.x or earlier may not work properly when called from code built with 7.x (and vice-versa). As long as all your C++ code is built with GCC 7.1 or later, you can safely ignore this warning. To disable it, pass -Wno-psabi
to the compiler.
有关更改内容的更多详细信息,请参见 GCC 7更改日志和相关的错误.
For more details on the context of the change, see the GCC 7 changelog, and the associated bug.
这篇关于gcc警告“传递给X的项目参数在GCC 7.1中已更改"是什么?意思是?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!