使用Mex和IT ++编译问题

时间:2012-11-28 18:36:48

标签: c++ matlab mex

我在编译It ++库时遇到问题。我已正确安装它并使用一个没有mex的简单示例对其进行了测试。

mex it_mex_fkmigration.cpp -litpp

it_mex_fkmigration.cpp:1:25: error: itpp/itcomm.h: No such file or directory
it_mex_fkmigration.cpp:2:26: error: itpp/itmex.h: No such file or directory
it_mex_fkmigration.cpp:4: error: expected namespace-name before ';' token
it_mex_fkmigration.cpp:4: error: '<type error>' is not a namespace
it_mex_fkmigration.cpp:6: error: 'mxArray' has not been declared
it_mex_fkmigration.cpp:6: error: expected ',' or '...' before '*' token
it_mex_fkmigration.cpp:6: error: ISO C++ forbids declaration of 'mxArray' with no type
it_mex_fkmigration.cpp: In function 'void mexFunction(int, int**, int, int)':
it_mex_fkmigration.cpp:9: error: 'mexErrMsgTxt' was not declared in this scope
it_mex_fkmigration.cpp:10: error: 'mexErrMsgTxt' was not declared in this scope
it_mex_fkmigration.cpp:13: error: 'bvec' was not declared in this scope
it_mex_fkmigration.cpp:13: error: expected `;' before 'input_bits'  
it_mex_fkmigration.cpp:16: error: 'cvec' was not declared in this scope
it_mex_fkmigration.cpp:16: error: expected `;' before 'output_symbols'
it_mex_fkmigration.cpp:17: error: 'QPSK' was not declared in this scope
it_mex_fkmigration.cpp:17: error: expected `;' before 'qpsk'
it_mex_fkmigration.cpp:19: error: 'output_symbols' was not declared in this scope
it_mex_fkmigration.cpp:19: error: 'qpsk' was not declared in this scope
it_mex_fkmigration.cpp:19: error: 'input_bits' was not declared in this scope
it_mex_fkmigration.cpp:23: error: 'mxCOMPLEX' was not declared in this scope
it_mex_fkmigration.cpp:23: error: 'mxCreateDoubleMatrix' was not declared in this scope
it_mex_fkmigration.cpp:26: error: 'cvec2mxArray' was not declared in this scope 

1 个答案:

答案 0 :(得分:0)

您需要告诉mex It ++库所在的位置。使用-I选项指定包含路径;和-L选项指定库搜索路径。

mex it_mex_fkmigration.cpp -litpp -Ipath/to/it++/library -Lpath/to/libitpp

过去我使用-L选项遇到了麻烦,并且必须通过使用-l选项指定库的完整路径来解决此问题。

mex it_mex_fkmigration.cpp -lpath/to/libitpp/libitpp.a -Ipath/to/it++/library

可以传递给mex的其他选项列在documentation中(在 Mex脚本开关部分下)。

此外,关于mxArraymexErrMsgTxt等的错误表明您未在mex.h中包含it_mex_fkmigration.cpp