cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Debug configuration of TOOLKIT projects

DomenicLaritz
16-Pearl

Debug configuration of TOOLKIT projects

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

ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

5 REPLIES 5

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

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.

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

Today I read through the PTC article CS237146, where the six toolkit lib files are explained.
I noticed that I was misled by the "md" in the name of the protk_dllmd_NU.lib library: This "md" obviously doesn't mean that it is the debug version of the protk_dll_NU.lib library.

 

So I think this issue is over for now.

 

Thanks for your support!

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.

 

Announcements


Top Tags