Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Libcpmt.lib: Error LNK2038 mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease'

While compiling a current project I get a bunch (about 80) of Linker errors that I don't know anymore how to debug further.

I am using Visual Studio 2019. It's a C++ project compiled on Windows 10.

A lot of them come from a library called libcpmt.lib. There are 2 types of error related to the library:

First it claims some function s are alredy defined in msvcprt.lib(MSVCP140.dll) (which is strange since I am using Visual Studio 2019 v142)

Error LNK2005 "protected: __cdecl std::locale::facet::facet(unsigned __int64)" (??0facet@locale@std@@IEAA@_K@Z) already defined in msvcprt.lib(MSVCP140.dll)    DataConverter   path_to_project\libcpmt.lib(locale0.obj)

and second it claims that libcpmt.lib is compiled statically while my project used dynamically linked libraries.

Error LNK2038 mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in annotation.obj    DataConverter   path_to_project\libcpmt.lib(xstol.obj)  1

The same error also appears on a library called mpirxx.lib

Error   LNK2038 mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in annotation.obj  DataConverter   path_to_project\mpirxx.lib(osmpf.obj)   1   

and

Error LNK2005 "public: void __cdecl std::basic_ostream<char,struct std::char_traits<char> >::_Osfx(void)" (?_Osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAXXZ) already defined in mpirxx.lib(osmpf.obj)    DataConverter   path_to_project\msvcprt.lib(MSVCP140.dll)   1   

From what little I found about the lib on the internet it appears to be included when your C++->Code Generation->Runtime Library is set to MT, but my settings are set to MD.

I am including a lot of external libraries in my project:

flann.lib
flann_cpp.lib
Qt5Widgets.lib
qtmain.lib
Qt5Gui.lib
Qt5Core.lib
libboost_atomic-vc142-mt-x64-1_74.lib
libboost_chrono-vc142-mt-x64-1_74.lib
libboost_container-vc142-mt-x64-1_74.lib
libboost_context-vc142-mt-x64-1_74.lib
libboost_contract-vc142-mt-x64-1_74.lib
libboost_coroutine-vc142-mt-x64-1_74.lib
libboost_date_time-vc142-mt-x64-1_74.lib
libboost_exception-vc142-mt-x64-1_74.lib
libboost_fiber-vc142-mt-x64-1_74.lib
libboost_graph-vc142-mt-x64-1_74.lib
libboost_iostreams-vc142-mt-x64-1_74.lib
libboost_locale-vc142-mt-x64-1_74.lib
libboost_log_setup-vc142-mt-x64-1_74.lib
libboost_log-vc142-mt-x64-1_74.lib
libboost_math_c99f-vc142-mt-x64-1_74.lib
libboost_math_c99l-vc142-mt-x64-1_74.lib
libboost_math_c99-vc142-mt-x64-1_74.lib
libboost_math_tr1f-vc142-mt-x64-1_74.lib
libboost_math_tr1l-vc142-mt-x64-1_74.lib
libboost_math_tr1-vc142-mt-x64-1_74.lib
libboost_nowide-vc142-mt-x64-1_74.lib
libboost_numpy37-vc142-mt-x64-1_74.lib
libboost_prg_exec_monitor-vc142-mt-x64-1_74.lib
libboost_program_options-vc142-mt-x64-1_74.lib
libboost_python37-vc142-mt-x64-1_74.lib
libboost_random-vc142-mt-x64-1_74.lib
libboost_regex-vc142-mt-x64-1_74.lib
libboost_serialization-vc142-mt-x64-1_74.lib
libboost_stacktrace_noop-vc142-mt-x64-1_74.lib
libboost_stacktrace_windbg_cached-vc142-mt-x64-1_74.lib
libboost_stacktrace_windbg-vc142-mt-x64-1_74.lib
libboost_system-vc142-mt-x64-1_74.lib
libboost_test_exec_monitor-vc142-mt-x64-1_74.lib
libboost_thread-vc142-mt-x64-1_74.lib
libboost_timer-vc142-mt-x64-1_74.lib
libboost_type_erasure-vc142-mt-x64-1_74.lib
libboost_unit_test_framework-vc142-mt-x64-1_74.lib
libboost_wave-vc142-mt-x64-1_74.lib
libboost_wserialization-vc142-mt-x64-1_74.lib
bz2.lib
libpng16.lib
lz4.lib
lzma.lib
mpfr.lib
mpir.lib
mpirxx.lib
qhullcpp.lib
xxhash.lib
zlib.lib
zstd.lib
gmp.lib
glew32.lib
glew32s.lib
opencv_world440.lib
vtkChartsCore-9.0.lib
vtkCommonColor-9.0.lib
vtkCommonComputationalGeometry-9.0.lib
vtkCommonCore-9.0.lib
vtkCommonDataModel-9.0.lib
vtkCommonExecutionModel-9.0.lib
vtkCommonMath-9.0.lib
vtkCommonMisc-9.0.lib
vtkCommonSystem-9.0.lib
vtkCommonTransforms-9.0.lib
vtkDICOMParser-9.0.lib
vtkDomainsChemistry-9.0.lib
vtkdoubleconversion-9.0.lib
vtkexodusII-9.0.lib
vtkexpat-9.0.lib
vtkFiltersAMR-9.0.lib
vtkFiltersCore-9.0.lib
vtkFiltersExtraction-9.0.lib
vtkFiltersFlowPaths-9.0.lib
vtkFiltersGeneral-9.0.lib
vtkFiltersGeneric-9.0.lib
vtkFiltersGeometry-9.0.lib
vtkFiltersHybrid-9.0.lib
vtkFiltersHyperTree-9.0.lib
vtkFiltersImaging-9.0.lib
vtkFiltersModeling-9.0.lib
vtkFiltersParallel-9.0.lib
vtkFiltersParallelImaging-9.0.lib
vtkFiltersPoints-9.0.lib
vtkFiltersProgrammable-9.0.lib
vtkFiltersSelection-9.0.lib
vtkFiltersSMP-9.0.lib
vtkFiltersSources-9.0.lib
vtkFiltersStatistics-9.0.lib
vtkFiltersTexture-9.0.lib
vtkFiltersTopology-9.0.lib
vtkFiltersVerdict-9.0.lib
vtkfreetype-9.0.lib
vtkGeovisCore-9.0.lib
vtkgl2ps-9.0.lib
vtkglew-9.0.lib
vtkhdf5-9.0.lib
vtkhdf5_hl-9.0.lib
vtkImagingColor-9.0.lib
vtkImagingCore-9.0.lib
vtkImagingFourier-9.0.lib
vtkImagingGeneral-9.0.lib
vtkImagingHybrid-9.0.lib
vtkImagingMath-9.0.lib
vtkImagingMorphological-9.0.lib
vtkImagingSources-9.0.lib
vtkImagingStatistics-9.0.lib
vtkImagingStencil-9.0.lib
vtkInfovisCore-9.0.lib
vtkInfovisLayout-9.0.lib
vtkInteractionImage-9.0.lib
vtkInteractionStyle-9.0.lib
vtkInteractionWidgets-9.0.lib
vtkIOAMR-9.0.lib
vtkIOAsynchronous-9.0.lib
vtkIOCityGML-9.0.lib
vtkIOCore-9.0.lib
vtkIOEnSight-9.0.lib
vtkIOExodus-9.0.lib
vtkIOExport-9.0.lib
vtkIOExportGL2PS-9.0.lib
vtkIOExportPDF-9.0.lib
vtkIOGeometry-9.0.lib
vtkIOImage-9.0.lib
vtkIOImport-9.0.lib
vtkIOInfovis-9.0.lib
vtkIOLegacy-9.0.lib
vtkIOLSDyna-9.0.lib
vtkIOMINC-9.0.lib
vtkIOMotionFX-9.0.lib
vtkIOMovie-9.0.lib
vtkIONetCDF-9.0.lib
vtkIOOggTheora-9.0.lib
vtkIOParallel-9.0.lib
vtkIOParallelXML-9.0.lib
vtkIOPLY-9.0.lib
vtkIOSegY-9.0.lib
vtkIOSQL-9.0.lib
vtkIOTecplotTable-9.0.lib
vtkIOVeraOut-9.0.lib
vtkIOVideo-9.0.lib
vtkIOXML-9.0.lib
vtkIOXMLParser-9.0.lib
vtkjpeg-9.0.lib
vtkjsoncpp-9.0.lib
vtklibharu-9.0.lib
vtklibproj-9.0.lib
vtklibxml2-9.0.lib
vtkloguru-9.0.lib
vtklz4-9.0.lib
vtklzma-9.0.lib
vtkmetaio-9.0.lib
vtknetcdf-9.0.lib
vtkogg-9.0.lib
vtkParallelCore-9.0.lib
vtkParallelDIY-9.0.lib
vtkpng-9.0.lib
vtkpugixml-9.0.lib
vtkRenderingAnnotation-9.0.lib
vtkRenderingContext2D-9.0.lib
vtkRenderingCore-9.0.lib
vtkRenderingFreeType-9.0.lib
vtkRenderingGL2PSOpenGL2-9.0.lib
vtkRenderingImage-9.0.lib
vtkRenderingLabel-9.0.lib
vtkRenderingLOD-9.0.lib
vtkRenderingOpenGL2-9.0.lib
vtkRenderingSceneGraph-9.0.lib
vtkRenderingUI-9.0.lib
vtkRenderingVolume-9.0.lib
vtkRenderingVolumeOpenGL2-9.0.lib
vtkRenderingVtkJS-9.0.lib
vtksqlite-9.0.lib
vtksys-9.0.lib
vtkTestingRendering-9.0.lib
vtktheora-9.0.lib
vtktiff-9.0.lib
vtkverdict-9.0.lib
vtkViewsContext2D-9.0.lib
vtkViewsCore-9.0.lib
vtkViewsInfovis-9.0.lib
vtkWrappingTools-9.0.lib
vtkzlib-9.0.lib
pcl_common.lib
pcl_features.lib
pcl_filters.lib
pcl_io.lib
pcl_io_ply.lib
pcl_kdtree.lib
pcl_keypoints.lib
pcl_ml.lib
pcl_octree.lib
pcl_recognition.lib
pcl_registration.lib
pcl_search.lib
pcl_segmentation.lib
pcl_sample_consensus.lib
pcl_stereo.lib
pcl_surface.lib
pcl_tracking.lib

Does anybody have an idea how to further debug or fix these issues?

PS: I currently have another error which is likely unrelated but I wanted to include it for completeness. The linker can't find the lib for loadPolygonFilePLY. Likely I'm just missing an additional pcl lib. If anybody happens to know how it's called please also comment:

Error LNK2001 unresolved external symbol "int __cdecl pcl::io::loadPolygonFilePLY(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,struct pcl::PolygonMesh &)" (?loadPolygonFilePLY@io@pcl@@YAHAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEAUPolygonMesh@2@@Z)
like image 440
Bernhard Jaeger Avatar asked Oct 19 '25 05:10

Bernhard Jaeger


1 Answers

In case somebody comes along a similar issue. These was a library in my included libraries that was using the static linkage (mpirxx.lib). A good way to debug this is to put /VERBOSE:LIB in your linker options. Then build and go to your Output windows where you can see which is the first library to trigger this error chain.

Thanks to Alan Birtles for the help.

like image 124
Bernhard Jaeger Avatar answered Oct 21 '25 20:10

Bernhard Jaeger



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!