compiling MEX unresolved external symbol

4 views (last 30 days)
When i try to compile some file with mex function in matlab, i get this error:
compile_command =
mex -DCOMPILE_VISUALIZATION -I"C:\local\boost_1_59_0" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include" -L"./lib/" -L"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\x64" -L"C:\local\boost_1_59_0\lib64-msvc-14.0" -L"./lib/" -llibParallelFDTD -lVoxelizer -lcudart -lcuda -lfreeglut -lglew32 -llibboost_thread-vc140-mt-1_59 -llibboost_system-vc140-mt-1_59 -llibboost_chrono-vc140-mt-1_59 -llibboost_date_time-vc140-mt-1_59 -llibmx -llibut
Building with 'Microsoft Visual C++ 2015 Professional'.
Error using mex
Creating library mex_FDTD.lib and object mex_FDTD.exp
mex_FDTD.obj : error LNK2019: unresolved external symbol "public: void __cdecl FDTD::App::runVisualization(void)"
(?runVisualization@App@FDTD@@QEAAXXZ) referenced in function mexFunction
mex_FDTD.mexw64 : fatal error LNK1120: 1 unresolved externals
Error in compileWIN (line 39)
eval([compile_command ' mex_FDTD.cpp']);
I found that problem is related to runVisualization function but i could not find the reason. When this function is commented in mex_FDTD.cpp file,
eval([compile_command ' mex_FDTD.cpp'])
is working but some errors occurs than when running main project file in matlab.
I've been stuck with this problem, I'll be thankful for any suggestions and comments.

Accepted Answer

Aman Vyas
Aman Vyas on 4 Nov 2020
Hi,
You can have a look at similar question and follow the steps as shared:
You mention a library file FDTD.lib but I don't see you use it. Try including it in the mex command so it gets linked in (have all files in the current directory):
mex FDTT.lib and other files too.
Hope it helps !

More Answers (0)

Categories

Find more on Software Development Tools in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!