×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

linking problem of .obj files in matlab

linking problem of .obj files in matlab

linking problem of .obj files in matlab

(OP)
Hi everyone,
I have a problem with linking of .obj files created by the command
>> mex -c *.cpp
This command succesfully compiles all cpp and header files  in my working directory. However when I try to link them with the command
>> mex -v main.cpp
I get the following error report:
-> Default options filename found in C:\Documents and Settings\cihan\Application Data\MathWorks\MATLAB\R2006b
----------------------------------------------------------------
->    Options file           = C:\Documents and Settings\cihan\Application Data\MathWorks\MATLAB\R2006b\mexopts.bat
      MATLAB                 = C:\PROGRA~1\MATLAB\R2006b
->    COMPILER               = cl
->    Compiler flags:
         COMPFLAGS           = -c -Zp8 -G5 -GR -W3 -DMATLAB_MEX_FILE -nologo
         OPTIMFLAGS          = /MD -O2 -Oy- -DNDEBUG
         DEBUGFLAGS          = /MD -Zi -Fd"main.mexw32.pdb"
         arguments           =  
         Name switch         = /Fo
->    Pre-linking commands   =  
->    LINKER                 = link
->    Link directives:
         LINKFLAGS           = /dll /export:mexFunction /MAP /LIBPATH:"C:\PROGRA~1\MATLAB\R2006b\extern\lib\win32\microsoft" libmx.lib libmex.lib libmat.lib /implib:C:\DOCUME~1\cihan\LOCALS~1\Temp\mex_26FE4922-4E1A-4465-75B7-D4A97DB04E6A\templib.x /MACHINE:X86 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
         LINKDEBUGFLAGS      = /DEBUG /PDB:"main.mexw32.pdb"
         LINKFLAGSPOST       =  
         Name directive      = /out:"main.mexw32"
         File link directive =  
         Lib. link directive =  
         Rsp file indicator  = @
->    Resource Compiler      = rc /fo "mexversion.res"
->    Resource Linker        =  
----------------------------------------------------------------
 
 
--> "cl  -c -Zp8 -G5 -GR -W3 -DMATLAB_MEX_FILE -nologo /FoC:\DOCUME~1\cihan\LOCALS~1\Temp\mex_26FE4922-4E1A-4465-75B7-D4A97DB04E6A\main.obj -IC:\PROGRA~1\MATLAB\R2006b\extern\include -IC:\PROGRA~1\MATLAB\R2006b\simulink\include /MD -O2 -Oy- -DNDEBUG -DMX_COMPAT_32 main.cpp"
 
main.cpp
    Contents of C:\DOCUME~1\cihan\LOCALS~1\Temp\mex_26FE4922-4E1A-4465-75B7-D4A97DB04E6A\mex_tmp.rsp:
  C:\DOCUME~1\cihan\LOCALS~1\Temp\mex_26FE4922-4E1A-4465-75B7-D4A97DB04E6A\main.obj
 
 
--> "link /out:"main.mexw32" /dll /export:mexFunction /MAP /LIBPATH:"C:\PROGRA~1\MATLAB\R2006b\extern\lib\win32\microsoft" libmx.lib libmex.lib libmat.lib /implib:C:\DOCUME~1\cihan\LOCALS~1\Temp\mex_26FE4922-4E1A-4465-75B7-D4A97DB04E6A\templib.x /MACHINE:X86 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  @C:\DOCUME~1\cihan\LOCALS~1\Temp\mex_26FE4922-4E1A-4465-75B7-D4A97DB04E6A\mex_tmp.rsp  "
 
Microsoft (R) Incremental Linker Version 7.10.3077
Copyright (C) Microsoft Corporation.  All rights reserved.
 
C:\DOCUME~1\cihan\LOCALS~1\Temp\mex_26FE4922-4E1A-4465-75B7-D4A97DB04E6A\main.obj  
   Creating library C:\DOCUME~1\cihan\LOCALS~1\Temp\mex_26FE4922-4E1A-4465-75B7-D4A97DB04E6A\templib.x and object C:\DOCUME~1\cihan\LOCALS~1\Temp\mex_26FE4922-4E1A-4465-75B7-D4A97DB04E6A\templib.exp
main.obj : error LNK2019: unresolved external symbol "public: __thiscall PQP_Model::~PQP_Model(void)" (??1PQP_Model@@QAE@XZ) referenced in function "public: void * __thiscall PQP_Model::`scalar deleting destructor'(unsigned int)" (??_GPQP_Model@@QAEPAXI@Z)
main.obj : error LNK2019: unresolved external symbol "public: __thiscall PQP_CollideResult::~PQP_CollideResult(void)" (??1PQP_CollideResult@@QAE@XZ) referenced in function _mexFunction
main.obj : error LNK2019: unresolved external symbol "int __cdecl PQP_Tolerance(struct PQP_ToleranceResult *,double (* const)[3],double * const,class PQP_Model *,double (* const)[3],double * const,class PQP_Model *,double,int)" (?PQP_Tolerance@@YAHPAUPQP_ToleranceResult@@QAY02NQANPAVPQP_Model@@123NH@Z) referenced in function _mexFunction
main.obj : error LNK2019: unresolved external symbol "int __cdecl PQP_Distance(struct PQP_DistanceResult *,double (* const)[3],double * const,class PQP_Model *,double (* const)[3],double * const,class PQP_Model *,double,double,int)" (?PQP_Distance@@YAHPAUPQP_DistanceResult@@QAY02NQANPAVPQP_Model@@123NNH@Z) referenced in function _mexFunction
main.obj : error LNK2019: unresolved external symbol "int __cdecl PQP_Collide(struct PQP_CollideResult *,double (* const)[3],double * const,class PQP_Model *,double (* const)[3],double * const,class PQP_Model *,int)" (?PQP_Collide@@YAHPAUPQP_CollideResult@@QAY02NQANPAVPQP_Model@@123H@Z) referenced in function _mexFunction
main.obj : error LNK2019: unresolved external symbol "public: __thiscall PQP_CollideResult::PQP_CollideResult(void)" (??0PQP_CollideResult@@QAE@XZ) referenced in function _mexFunction
main.obj : error LNK2019: unresolved external symbol "public: int __thiscall PQP_Model::MemUsage(int)" (?MemUsage@PQP_Model@@QAEHH@Z) referenced in function _mexFunction
main.obj : error LNK2019: unresolved external symbol "public: int __thiscall PQP_Model::EndModel(void)" (?EndModel@PQP_Model@@QAEHXZ) referenced in function _mexFunction
main.obj : error LNK2019: unresolved external symbol "public: int __thiscall PQP_Model::AddTri(double const *,double const *,double const *,int)" (?AddTri@PQP_Model@@QAEHPBN00H@Z) referenced in function _mexFunction
main.obj : error LNK2019: unresolved external symbol "public: int __thiscall PQP_Model::BeginModel(int)" (?BeginModel@PQP_Model@@QAEHH@Z) referenced in function _mexFunction
main.obj : error LNK2019: unresolved external symbol "public: __thiscall PQP_Model::PQP_Model(void)" (??0PQP_Model@@QAE@XZ) referenced in function _mexFunction
main.mexw32 : fatal error LNK1120: 11 unresolved externals
 
  C:\PROGRA~1\MATLAB\R2006B\BIN\MEX.PL: Error: Link of 'main.mexw32' failed.
 
??? Error using ==> mex
Unable to complete successfully.

I am using Microsoft 7.1 compiler and Matlab 7.3. I am able to succesfully build, link and execute any mex examples under \extern\examples\mex directory.
Does anyone observe any solution to my problem?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources