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

  • Thread starter physical101
  • Start date
  • Tags
    Code
In summary, the biologist is seeking help with integrating an executable program into MATLAB. They are encountering unresolved linker errors and have checked for missing header files and compatibility issues. They may need to seek support from the developer of the program.
  • #1
physical101
47
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
  • #2


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
 

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

1. What is a Mex compilation of cpp code?

A Mex compilation of cpp code refers to the process of compiling C++ code into a shared library that can be called from within MATLAB. This allows for the integration of C++ code with MATLAB, providing additional functionality and speed.

2. How is a Mex compilation of cpp code different from regular compilation?

A Mex compilation is specifically optimized for integration with MATLAB, while regular compilation is optimized for stand-alone execution. A Mex compilation also uses the MATLAB API for communication between MATLAB and the C++ code.

3. What are the advantages of using a Mex compilation of cpp code?

Using a Mex compilation allows for the integration of high-performance C++ code with the user-friendly and interactive environment of MATLAB. This can greatly enhance the speed and functionality of MATLAB programs.

4. Can any C++ code be compiled into a Mex file?

No, the C++ code must be written in a specific format and must use the MATLAB API for communication. Additionally, the code must be compatible with the MATLAB compiler and be able to run on the same platform as MATLAB.

5. How can I learn how to create a Mex compilation of cpp code?

There are many resources available online, including tutorials and documentation from MATLAB, that can guide you through the process of creating a Mex compilation. Additionally, there are courses and workshops available that specifically focus on this topic.

Similar threads

  • Programming and Computer Science
Replies
6
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
Back
Top