无法加载,未定义的符号C++名称重整
unable to load, undefined symbol C++ name mangling
我在执行程序时收到以下错误:
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();
}
知道为什么编译器要修改函数,以便库不再找到它吗?
如果你在带有 gcc 的 Linux 上执行此操作:
根据 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
我想这个链接可能会有所帮助:
- 未定义的符号"vtable for ..."和"类型信息..."?
- http://lists.apple.com/archives/darwin-development/2003/Sep/msg00273.html
相关文章:
- 在C++中,将大的无符号浮点数四舍五入为整数的最佳方法是什么
- 有符号的int和int-有没有一种方法可以在C++中区分它们
- 将无符号char*转换为std::istream*C++
- 如何在C++中将一个无符号的 int 转换为两个无符号的短裤?
- vscode g++链路故障:体系结构x86_64的未定义符号
- 从矢量<无符号字符>转换为字符* 包括垃圾数据
- 如何理解将半精度指针转换为无符号长指针和相关的内存对齐
- Visual studio代码重构似乎不起作用(例如,重命名符号-f2)
- 使用gcc从静态链接的文件中查找可选符号
- C++中无符号字符溢出
- 使用无符号字符数组有效存储内存
- C++:Application.cpp中抛出了未解析的外部符号(解决方案在问题的末尾,供未来的读者参考)
- VC++本机单元测试,找不到调试符号
- 为什么我必须在C++中添加一个赋值符号来声明一个数组
- 检查TCHAR数组输入是否为带符号整数C++
- 用符号版本替换对函数的所有调用
- 未解析的外部符号_MsiLocateComponentW@12.
- 如何打印boost多精度128位无符号整数
- C++模板函数,用于比较任何无符号整数和有符号整数
- 在 Mac 上使用 CMAKE 将 FFTW 和 FFTWPP 链接到项目中时未定义的符号