Error occurs when linking MAT file using CUDA Nsight eclipse version on Mac OSX

system:Mac OS 10.8.2 64bit

IDE: NVIDIA Nsight Eclipse version.(used for CUDA developing)

Problem description:

I tried to use Matlab C++ interface in CUDA code. I included the extern/include directory(using -I/${MATLAB}/extern/include), and linked the bin/maci64 and sys/os/maci64. And here is the problem.

I can use Matlab Engine in CUDA code. It starts well, works well. I can execute commands properly. Everything is just fine untill I tried to use .mat file interface. The error is the canonical "Undefined symbols:__mxCreateDoubleMatrix__730 " I tried every thing but no effect at all. And the most interesting thing is that I can use gcc to compile the same matlab code with exactly the same settings. So I’m pretty sure it is the nvcc compiler’s problem.

Could anyone give any advice about it? The CUDA and Matlab combination is really cool and I really want to use them together.

It looks like you have not configured libraries to link against. Can you provide here the linker command Nsight issues?

the command is here:

-L/Developer/NVIDIA/CUDA-5.0/lib -L/usr/lib -L/usr/local/lib -L/opt/X11/lib -L/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries -L/Applications/MATLAB_R2012b.app/bin/maci64 -m64 -Xlinker -rpath -Xlinker /Applications/MATLAB_R2012b.app/bin/maci64 -Xlinker -framework,OpenGL,-framework,GLUT

There does not appear to be any Matlab library in the linker arguments (-L are library paths, -l should be used to specify libraries).