在执行我的程序时,我会得到以下错误:
E:无法加载libsim.so: libsim.so:未定义符号:_ZTV15IteratorRegFile
在sim.cpp中有s.th。喜欢
//IteratorRegFileIs is a wrapper that calls the constructor for IteratorRegFile
Fwk::Ptr<IteratorRegFile> iteratorRegFile_ = IteratorRegFile::IteratorRegFileIs( "RF" );
void init(){
SparseArrayInt64 *sparse_array = new SparseArrayInt64(segID);
}在SparseArrayInt64.cpp中:
extern Fwk::Ptr<IteratorRegFile> iteratorRegFile_;IteratorRegFile.h:
public:
static IteratorRegFile::ValidPtr IteratorRegFileIs(Tac::Name _name) {
IteratorRegFile * m = new IteratorRegFile(_name);
m->referencesDec(1);
return m;
}
protected:
IteratorRegFile( const IteratorRegFile& );
explicit IteratorRegFile(Tac::Name _name): Tac::Entity(_name),
index_(0) {
handleInit();
}知道为什么编译器会破坏函数,这样库就不会再找到它了吗?
发布于 2012-05-18 04:50:51
如果您在Linux上与gcc一起执行此操作:
根据c++filt的说法,_ZTV15IteratorRegFile是vtable for IteratorRegFile。因此,损坏的名称指的是vtvable,而不是您的函数。
我搜索了一下,发现了这个建议,"You must implement virtual methods of your class because that's when the compiler actually generates the vtable for it."
您可以以这种方式检查模块中有哪些符号:
nm your-module-name
我想这个链接可能会有帮助:
https://stackoverflow.com/questions/10644471
复制相似问题