[英]Unused classes removed
I have the following code: 我有以下代码:
namespace rm {
namespace lib {
class Object {
public:
Object() {printf("Hi\n");}
};
}
}
Now I wanted to compile the class into an shared library using g++ -Wall -Wno-unused -Werror -fPIC -g -Iinclude/ -c -O0 -o object.o object.cpp
and g++ --shared -o librm.so object.o
. 现在我想使用
g++ -Wall -Wno-unused -Werror -fPIC -g -Iinclude/ -c -O0 -o object.o object.cpp
和g++ --shared -o librm.so object.o
将类编译为共享库g++ --shared -o librm.so object.o
。 Compilation works with no problems, however after checking the resulting library with nm librm.so | c++filt
编译没有问题,但是使用
nm librm.so | c++filt
检查生成的库后nm librm.so | c++filt
nm librm.so | c++filt
, rm::lib::Object::Object()
is nowhere to be found. nm librm.so | c++filt
, rm::lib::Object::Object()
找不到。 GCC gives out no warning, even with -Wextra enabled. 即使启用了-Wextra,GCC也不会发出警告。
G++ version is (Raspbian 4.9.2-10) 4.9.2 G ++版本是(Raspbian 4.9.2-10)4.9.2
在类中定义的代码被隐式标记为inline
(并且不使用),因此不会保存在文件中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.