Linking Error using Mex

I have a long list of code distributed over multiple directories. I have written a mex function to access these cpp code from Matlab. I am using the following command to compile and link it:
mex -c test_ARGUS.cpp -IC:/Argus ... -IC:/Platform ... -IC:/sigint ... -IC:/SimpleWAMI ... -IC:/Tracker ... -IC:/utils ... -IC:/Ground_Movers;
which compiles without any error
But when I do the above without "-c", it generates the following linking error: Any help?
Creating library C:\Users\NILANJ~2.DAS\AppData\Local\Temp\mex_i18Q7G\templib.x and object C:\Users\NILANJ~2.DAS\AppData\Local\Temp\mex_i18Q7G\templib.exp
test_ARGUS_offlineMex.obj : error LNK2019: unresolved external symbol "public: __cdecl Ve_Argus_sensor_system::~Ve_Argus_sensor_system(void)" (??1Ve_Argus_sensor_system@@QEAA@XZ) referenced in function mexFunction
test_ARGUS_offlineMex.obj : error LNK2019: unresolved external symbol "public: __cdecl Ve_platform::~Ve_platform(void)" (??1Ve_platform@@QEAA@XZ) referenced in function mexFunction
test_ARGUS_offlineMex.obj : error LNK2019: unresolved external symbol "public: void __cdecl Ve_Argus_sensor_system::initialize(class Ve_Argus_sensor_system_init &)" (?initialize@Ve_Argus_sensor_system@@QEAAXAEAVVe_Argus_sensor_system_init@@@Z) referenced in function mexFunction
test_ARGUS_offlineMex.obj : error LNK2019: unresolved external symbol "public: __cdecl Ve_Argus_sensor_system_init::Ve_Argus_sensor_system_init(void)" (??0Ve_Argus_sensor_system_init@@QEAA@XZ) referenced in function mexFunction
test_ARGUS_offlineMex.obj : error LNK2019: unresolved external symbol "public: __cdecl Ve_platform::Ve_platform(void)" (??0Ve_platform@@QEAA@XZ) referenced in function mexFunction
test_ARGUS_offlineMex.obj : error LNK2019: unresolved external symbol "public: __cdecl Ve_Argus_sensor_system::Ve_Argus_sensor_system(void)" (??0Ve_Argus_sensor_system@@QEAA@XZ) referenced in function mexFunction
test_ARGUS_offlineMex.mexw64 : fatal error LNK1120: 6 unresolved externals
C:\PROGRA~1\MATLAB\R2010B\BIN\MEX.PL: Error: Link of 'test_ARGUS.mexw64' failed.

Respuestas (1)

Kaustubha Govind
Kaustubha Govind el 13 de Nov. de 2012

0 votos

You need to link against the object/library files that contain the definition of Ve_Argus_sensor_system, etc. You can simply tag on additional .obj or .c files to the mex command (right after your file name test_ARGUS.cpp), or use the -l option to link against libraries.

Categorías

Más información sobre Startup and Shutdown en Centro de ayuda y File Exchange.

Productos

Etiquetas

Preguntada:

el 13 de Nov. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by