编译时出现体系结构x86_64错误的未定义符号
Undefined symbols for architecture x86_64 error when compiling
很简单,我得到了这个错误:
Undefined symbols for architecture x86_64:
"Tetris::rotate(int (*) [2], int)", referenced from:
Tetris::add_piece(char, int, int) in tetris-8a8072.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
这是我的轮换函数:
int** rotate(int oldpiece[][2],int rot){
int **newpiece= new int*[4];
for (unsigned int i=0; i<4; ++i){
newpiece[i] = new int[2];
}
for (unsigned int i=0; i<4; ++i){
for (unsigned int j=0; j<2; ++j){
newpiece[i][j]=oldpiece[i][j];
}
}
return newpiece;
}
旧的部分是一个4x2的int数组。
到目前为止,该函数所要做的就是将oldpiece
复制到newpiece
,然后复制到return newpiece;
。我不知道这个错误是什么意思。
您有外部库吗?如果是,则必须将其链接。另外,请尝试在release选项而不是debug选项下编译程序。
相关文章:
- 错误:未定义对cv::cudacodec::createVideoReader的引用
- Pybind11 错误未定义对"Py_GetVersion"的引用
- 纯虚拟类和错误未定义对 'vtable 的引用
- 为什么我会收到链接器错误:未定义对 ..?
- 链接错误:未定义对 stdscr 和 wgetch 的引用
- 尝试构建 xerces c++ 解析器。Netbeans 和命令行构建错误未定义对"xercesc_3_2..."的引用
- 错误:未定义的符号:gzclose opencv emscripten
- 我不断收到对项目"xxx"的错误未定义引用
- 我仍然收到此错误未定义的引用:boost::log::v2_mt_posix::trivial::logger::get
- 符号查找错误未定义的符号:curl_mime_init
- Omnet 和 Inet 链接错误:未定义对 typinfo 的引用
- 模拟 __name__ = __main__ 在 c++ 中会导致错误"未定义类似函数的宏"
- 链接器错误:未定义的引用C++
- OpenCv3.3安装错误-未定义对的引用
- CUDA 编译错误:未定义__hmul和__hneg
- C++错误:未定义对 (Winsock2.h) 的引用
- 错误:未定义对 .. 的引用.怎么了
- 无法生成项目,出现错误 - 未定义的体系结构符号 x86_64:"_JNI_CreateJavaVM"
- 编译错误:未定义的拱门
- C 编程原理和练习第7章练习4 symber_table :: get_value始终显示错误未定义