How to Resolve Linker Errors When Compiling CPP Code in MATLAB?

  • Thread starter Thread starter physical101
  • Start date Start date
  • Tags Tags
    Code
Click For Summary
SUMMARY

This discussion addresses the resolution of linker errors encountered when compiling C++ code in MATLAB, specifically on a 64-bit Windows 7 machine. The user, Physical101, faced unresolved external symbol errors related to the destructor of a class named "dependency." Key solutions include ensuring all necessary header files are included and properly referenced, verifying compatibility with the MATLAB version in use, and potentially consulting the program's developer for further assistance.

PREREQUISITES
  • Understanding of C++ programming and compilation processes
  • Familiarity with MATLAB's MEX file interface
  • Knowledge of linker error messages and their meanings
  • Experience with Windows 7 development environments
NEXT STEPS
  • Research how to properly configure MEX files in MATLAB
  • Learn about resolving linker errors in C++ projects
  • Explore compatibility issues between C++ libraries and MATLAB versions
  • Investigate the use of dependency management tools for C++
USEFUL FOR

This discussion is beneficial for biologists transitioning to informatics, C++ developers integrating their code with MATLAB, and anyone troubleshooting linker errors in a Windows development environment.

physical101
Messages
41
Reaction score
0
Dear All

I am a biologist trying hard to make it in the world of informatics and computing and I was wondering if one of you real scientists could help me.

I have a executable program with its associated .lib .exp and .pdb files.

I thought I could easily mex the cpp of this excutable using the above but I keep running into unresolved linker errors.

I am working on a 64 bit windows 7 machine and I am telling MATLAB to look in the right place for the .h files etc but I get warnings like this:

filename.obj : error LNK2019: unresolved external symbol "public: __cdecl dependency::~dependency(void)" (??1dependency@@QEAA@XZ) referenced in function "public: void * __cdecl dependency::`scalar deleting destructor'(unsigned int)" (??_GDRMImage@@QEAAPEAXI@Z)

I appreciate that this post is a bit abstract but any help you could give would be absolutely fantastic and I will buy you virtual chocolates and a virtual trip to las vagas.

Thank you

Physical101
 
Technology news on Phys.org


Dear Physical101,

I understand your frustration with trying to integrate your executable program into MATLAB. Linker errors can be tricky to resolve, but I am happy to offer some advice to help you out.

Firstly, make sure that all of the necessary header files are included in your MATLAB code and that they are properly referenced. Sometimes linker errors can occur if a header file is missing or not properly referenced.

Next, check that your code is compatible with the version of MATLAB you are using. If there are any compatibility issues, it could be causing the linker errors. You may need to make adjustments to your code or find a different version of MATLAB that is compatible with your program.

If the above steps do not resolve the issue, it may be helpful to reach out to the developer of your program for support. They may be able to provide more specific guidance on integrating it with MATLAB.

I hope this helps and best of luck with your informatics and computing pursuits! And thank you for the virtual chocolates and trip to Las Vegas, they are greatly appreciated.



A fellow scientist in the field of informatics and computing
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
2K
Replies
6
Views
5K
  • · Replies 13 ·
Replies
13
Views
2K
Replies
5
Views
2K
  • · Replies 20 ·
Replies
20
Views
28K
  • · Replies 1 ·
Replies
1
Views
1K