MATLAB coder compiled C++ library error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in main.obj

3 vues (au cours des 30 derniers jours)
Hi,
I tried to use a MATLAB coder compiled C++ library in vs 2017 but encountered the error below:
1> test_cv_2.lib(test_cv_2.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in main.obj
1> test_cv_2.lib(test_cv_2.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MDd_DynamicDebug' in main.obj
1> LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library [1]
I think the configuration may need to be setup from MATLAB coder as well:
0ZY3h.png
And there is another configuration in vs 2017
29vhN.png
Anyone have any idea on the correct settings based on the images above? Or is there any extra settings need to be done?
I have tried out several settings but the same error occur, for example, set Build configuration set to debug in MATLAB coder environment and Multi-threaded Debug DLL (/MDd) in vs 2017 setting.
Thank you.
  4 commentaires
Mukund Sankaran
Mukund Sankaran le 6 Déc 2018
As far as I'm aware, there is no readily available documentation on how to modify those settings in the MATLAB Coder app. We will consider adding this information to the documentation.
You could start by looking at the compiler/linker flags in the "Command Line" section of the C/C++ configuration properties in Visual Studio, and map them to the ones used in MATLAB Coder. If you open the Makefile for your MATLAB Coder project (this resides under the codegen folder, and is typically named <project>_rtw.mk), you can see the values being used for the flags specified in the toolchain options table.
Alternatively, if you do not need precompiled code from MATLAB coder, you can generate code only by choosing "Source Code" as the build type in the Generate Code step. You can then compile all your code in Visual Studio, which would eliminate the need to tweak the toolchain options.
Hope this helps.
kok wei
kok wei le 11 Déc 2018
Thanks, i will try again , appreciate the feedback

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur MATLAB Coder dans Help Center et File Exchange

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by