Linker error while compiling mexfunction with boost
Mostrar comentarios más antiguos
I'm trying to use boost in mexfunctions.
Given below is my code
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");
}
I compile it using the below command
mex main.cpp -LC:\Boost\1.55.0\VC\10.0\x64\stage\lib -IC:\Boost\1.55.0\VC\10.0\x64
Then i get this linking error
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.
Then I compiled again using,
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
&
mex 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-s-1_55
But still I get the same error. How can I solve this ?
EDIT :
I can use boost in a normal visual studio c++ project without any issue. The issue only comes when I put it in a mexfunction
2 comentarios
Kaustubha Govind
el 30 de Dic. de 2013
You might want to add the -v argument to your mex command to get a verbose log of the exact compiler/linker commands being run. You can compare these against your Visual Studio log to see what's different.
VINAYAK KARANDIKAR
el 28 de Mzo. de 2019
Hello,
i get a similar error:
LINK : fatal error LNK1104: cannot open file 'libboost_thread-vc100-mt-1_55.lib'
C:\PROGRA~1\MATLAB\R2013B\BIN\MEX.PL: Error: Link of 'uhdinterface.mexw64' failed.
What do i do?
Thanks a lot,
Vinayak Anant Karandikar
Respuestas (0)
Categorías
Más información sobre Write C Functions Callable from MATLAB (MEX Files) en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!