Using MCR in C++ project: undefined reference to `mclInitia​lizeCompon​entInstanc​eWithEmbed​dedCTF_pro​xy'

조회 수: 6 (최근 30일)
I am getting an undefined reference to a MCR function `mclInitializeComponentInstanceWithEmbeddedCTF_proxy' when trying to build a C++ application in Eclipse. This function is defined in mclmcr.h and mclmcrrt.h as part of MCR, which are both included in the project. I am using the most recent version of MCR.
When I build the project: (omitted most .o files for clarity)
make all Building target: MYPROJECT Invoking: GCC C++ Linker g++ -L"/sandbox/path/to/my/lib" -L/usr/include/boost -L/opt/matlab/MATLAB_Compiler_Runtime/v717/runtime/glnx86 ./all/my/files.o -lboost_thread-mt -lboost_system -lboost_filesystem -lpthread -lmwmclmcrrt
/sandbox/path/to/my/lib/mylib.so: undefined reference to `mclInitializeComponentInstanceWithEmbeddedCTF_proxy' collect2: ld returned 1 exit status make: * [MYPROJECT] Error 1

채택된 답변

Kaustubha Govind
Kaustubha Govind 2012년 8월 9일
편집: Kaustubha Govind 2012년 8월 9일
According to this solution, you may be linking against the wrong version of mclmcrrt.lib. You appear to be linking against the library corresponding to R2012a, but you need to get the one corresponding to the version of the MATLAB that you library was compiled with.
  댓글 수: 1
Leo
Leo 2012년 8월 10일
Downloading the appropriate MCR fixed the issue. I was using the latest MCR; however, I should have been using the same version as the MATLAB on which I was building the C++ shared library. For anyone having trouble finding the MCR for their MATLAB installation, from the MATLAB command prompt:
>> mcrinstaller
will give you the path to the installer for version of MCR you will need.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 C Shared Library Integration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by