Skip to main content
DomenicLaritz
16-Pearl
December 4, 2024
Solved

Debug configuration of TOOLKIT projects

  • December 4, 2024
  • 2 replies
  • 2911 views

In PTC article CS363748 are for the various Creo main versions TOOLKIT sample projects attached.
However, only the Debug configuration is preconfigured for these.

 

As our company is currently working with Creo 10.0, I have taken a closer look at the example project for this version.
However, my statements also apply to the projects of the other versions.
The Debug configuration can be compiled and linked, but in my opinion it is not correctly preset:
The project setting "Configuration Properties > C/C++ > Runtime Libary" should be changed from "Multi-threaded DLL (/MD)" to "Multi-threaded Debug DLL (/MDd)", shouldn't it?
Even if this change is made, the project can still be successfully compiled and linked.
However, if you then add the line "#include <string>" to the other header files at the beginning of the program code, the DLL can no longer be created and the following error messages appear in the output console:

 

Rebuild started...
1>------ Rebuild All started: Project: Creo_x64_tktemplate, Configuration: Debug x64 ------
1>PTTestBug.cpp
1>protk_dllmd_NU.lib(srcutf.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcutf.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(srccore.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(srccore.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcwrappers.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcwrappers.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcmemmgr_common.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcmemmgr_common.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcmemmgr.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcmemmgr.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(srci18n.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(srci18n.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(threadlibsrc.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(threadlibsrc.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcutfstr.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcutfstr.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcmemmgr_mt.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcmemmgr_mt.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(ctstack_utils.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(ctstack_utils.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcunicode.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcunicode.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcnet.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcnet.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcsconv.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcsconv.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcmtbase.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcmtbase.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(ctwithclang.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(ctwithclang.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcbase.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcbase.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcmemmgr_slim.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcmemmgr_slim.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcps.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcps.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(baselibsrc.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(baselibsrc.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(srccoll.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(srccoll.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(bufsrc.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(bufsrc.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(stringsrc.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(stringsrc.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(osapisrc.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(osapisrc.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(streamsrc.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(streamsrc.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcstream.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcstream.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcproc.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcproc.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcstdstream.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcstdstream.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(ostoolssrc.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(ostoolssrc.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(membufsrc.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(membufsrc.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcstring.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcstring.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(srctime.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(srctime.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcenv.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(srcenv.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(nmscomm.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(nmscomm.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(nmsclnt.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(nmsclnt.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1>protk_dllmd_NU.lib(stackwalksrc.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in PTTestBug.obj
1>protk_dllmd_NU.lib(stackwalksrc.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in PTTestBug.obj
1> Creating library …\Creo10_x64_tkSynctemplate_DLL\x64\Debug\\pt_bug.lib and object …\Creo10_x64_tkSynctemplate_DLL\x64\Debug\\pt_bug.exp
1>msvcprtd.lib(locale0_implib.obj) : error LNK2019: unresolved external symbol __imp__free_dbg referenced in function "public: static void __cdecl std::_Fac_node::operator delete(void *)" (??3_Fac_node@std@@SAXPEAX@Z)
1>msvcprtd.lib(locale0_implib.obj) : error LNK2019: unresolved external symbol __imp__malloc_dbg referenced in function "public: static void * __cdecl std::_Fac_node::operator new(unsigned __int64)" (??2_Fac_node@std@@SAPEAX_K@Z)
1>…\Creo10_x64_tkSynctemplate_DLL\x64\Debug\\pt_bug.dll : fatal error LNK1120: 2 unresolved externals
1>Done building project "Creo_x64_tktemplate.vcxproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

 

If I reset the project setting for the "Runtime Libary" to the value "Multi-threaded DLL (/MD)", strangely enough, it works again with the creation of the DLL.

Do you know what else I am doing wrong if I use the setting "Multi-threaded Debug DLL (/MDd)"?

 

Regards,
Domenic

Best answer by YaroslavSin

In case toolkit project, I think, no need to change flag to /MD.

For Release DLLs need to use "Standard libraries" /MT and remove flags for debugging (see below).

From Creo 9 toolkit documentation:

img-2024-12-05-15-56-29.pngimg-2024-12-05-15-57-37.pngimg-2024-12-05-15-57-57.png

2 replies

17-Peridot
December 5, 2024

Why would you want to change the configuration if you don't have problems compiling and debugging?

DomenicLaritz
16-Pearl
December 5, 2024

My aim is to create a Release configuration in addition to the Debug configuration.
In the Release configuration, I would then select the value "Multi-threaded DLL (/MD)" as the "Runtime Libary".
And in the setting "Configuration Properties > Linker > Input", the release library protk_dll_NU.lib should be used instead of the debug library protk_dllmd_NU.lib.

 

This gives me a Debug configuration that can be used during development and a Release configuration for the publication of an official version.
Release DLLs are normally somewhat smaller and also a little more performant.

17-Peridot
December 5, 2024

In case toolkit project, I think, no need to change flag to /MD.

For Release DLLs need to use "Standard libraries" /MT and remove flags for debugging (see below).

From Creo 9 toolkit documentation:

img-2024-12-05-15-56-29.pngimg-2024-12-05-15-57-37.pngimg-2024-12-05-15-57-57.png

12-Amethyst
December 5, 2024

We have found similar to you, and for our projects we need to use Multi-threaded DLL (/MD) for the Debug configuration to avoid LNK2038 build issues.

 

An issue that is awkward that we have to manage to keep on top of the build issues, but we have never found an ideal resolution or an explanation, so I am interested in hearing other peoples views on this.