无法导出mexfunction:符号未定义的collect.exe2.exe:错误:ld返回1退出状态
Cannot export mexFunction: symbol not defined collect2.exe: error: ld returned 1 exit status
i使用matlab r2017a,当我使用'mex pq_demo.cpp'编译C 文件时,它会出现错误:
无法导出mexFunction:未定义的符号
collect2.exe:错误:ld返回1退出状态
我的mexfunction在pq_create.cpp中:
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]){
// read the parameters
// check input
if( nrhs != 1 || !mxIsNumeric(prhs[0]) )
mexErrMsgTxt("A unique scalar number with the expected size of the queue is necessary.n");
// retrieve the data
int nelems = 100;
retrieve_data( prhs[0], nelems );
// instantiate the priority queue
MaxHeap<double>* pq = new MaxHeap<double>(nelems);
// convert the points to double
plhs[0] = mxCreateDoubleMatrix(1,1,mxREAL);
double* pointer_to_tree = mxGetPr(plhs[0]);
pointer_to_tree[0] = (long long) pq;
}
所以,我该如何解决错误。谢谢!
您应该首先包括头文件mex.h
,例如#include mex.h
相关文章:
- 试图在崇高中奔跑. 错误 已发生: 收集2.exe: 错误: ld 返回 1 退出状态
- 找不到 -llibmysqld Collect2.exe:错误:ld 返回 1 退出状态
- 使用 Arduino 对 ATtiny10 进行编程 ( "ld.exe" 错误)
- 每次我要使用外部资源时,我都会得到:collect2。exe:错误 ld 返回 1 退出状态
- mingw-w64 ... ld.exe: cannot find -lboost_filesystem
- Sysgcc: ld.exe cannot find -lcurl -ljsoncpp
- 对"displayForStudent(int, int const*, double const*, int)"的未定义引用 collect2.exe:错误:ld 返回 1 个退出状态
- mingw32/bin/ld.exe:找不到 -lfl collect2.exe:错误:ld 返回 1 个退出状态
- ld.exe找不到Protobuf 3.4.0的-lprotobuf
- 如何修复链接器错误"mingw32/bin/ld.exe: cannot find -lSDL"?
- 生成文件gtkmm;collect2.exe:错误:ld返回1退出状态
- gtest in eclipse error:ld.exe can not find -llibgtest
- 无法导出mexfunction:符号未定义的collect.exe2.exe:错误:ld返回1退出状态
- ld.exe cannot find -lGL
- ld.exe: cannot find -lstrmbase
- /Mingw32/bin/ld.exe: cannot find -llibcurl?
- collect2.exe:错误:ld在编译带有gradle 2.3的C++代码时返回1退出状态
- ld.exe: cannot find -lopencv_createsamples.exe
- MinGW/Eclipse ld.exe找不到库
- collect2.exe[错误]ld返回1退出状态