1
我想在mexfunctions中使用提升。鏈接器錯誤,同時編譯mexfunction與提升
下面給出的是我的代碼
的main.cpp
#include <mex.h>
#include <boost/thread.hpp>
#include <boost/date_time.hpp>
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
mexPrintf("test boost");
}
我使用下面的命令
mex main.cpp -LC:\Boost\1.55.0\VC\10.0\x64\stage\lib -IC:\Boost\1.55.0\VC\10.0\x64
然後編譯它,我得到這個鏈接錯誤
LINK : fatal error LNK1104: cannot open file 'libboost_thread-vc100-mt-1_55.lib'
C:\PROGRA~1\MATLAB\R2012A\BIN\MEX.PL: Error: Link of 'main.mexw64' failed.
然後我再編譯使用,
mex main.cpp -LC:\Boost\1.55.0\VC\10.0\x64\stage\lib -IC:\Boost\1.55.0\VC\10.0\x64 -llibboost_thread-vc100-mt-s-1_55
但我仍得到同樣的錯誤。我該如何解決這個問題?
編輯:
我總能以正常的Visual Studio C++項目使用助推,沒有任何問題。這個問題只是當我把它放在一個mexfunction
什麼鏈接器命令是mex爲您運行?也許它有一個詳細的標誌來打印。 –
我認爲這是你問的問題。命令是 errCode = runCmdInShell(cmdtool,cmdargs);其中「cmdtool = 」C:\ Program Files \ MATLAB \ R2012a \ sys \ perl \ win32 \ bin \ perl.exe「」C:\ Program Files \ MATLAB \ R2012a \ bin \ mex.pl「」 和「cmdargs = -called_from_matlab -matlab「C:\ Program Files \ MATLAB \ R2012a」main.cpp -LC:\ Boost \ 1.55.0 \ VC \ 10.0 \ x64 \ stage \ lib -IC:\ Boost \ 1.55.0 \ VC \ 10.0 \ x64 -lboost_thread-vc100-mt-1_55「 並且返回的errorCode爲2 – Optimus