0
Undefined symbols for architecture x86_64:
"Matrix::~Matrix()", referenced from:
_main in p1.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
当我尝试在xcode中编译时出现此错误。问题出在头文件中的这个析构函数声明中。如果我评论析构函数,它会成功建立。Xcode未定义符号〜析构函数
class Matrix {
public:
~Matrix();
};
你在哪里定义析构函数? – NathanOliver
我有三个文件:main,Matrix.hpp和Matrix.cpp。析构函数在Matrix.hpp中声明,并将在Matrix.cpp中定义。 – Char
在Matrix.cpp中定义了什么?它真的被编译/链接? –