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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

toolkit : c++ include failed

CAD_Jimmy
11-Garnet

toolkit : c++ include failed

hello all,

 

i use the vs2012 mfc dll c++ coding the toolkit.(debug x64 version)

 

when: #include <iostream> #include <vector> ...etc.

will cause the fail:

protk_dllmd.lib(srcenv.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2'
protk_dllmd.lib(srcenv.obj) :error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug'

 

but when i comment the toolkit function ,no problem appear.

 

anyone know what's wrong with?

hope some one can save me.....thanks!!!

fail.JPGsuc2.JPGsuccess.JPG

5 REPLIES 5

Do not comment any code. 

Give a try with below options for Project Pages --> Configuration Properties:

Go to C/C++ --> Preprocessor --> Preprocessor Definitions. Here, Add or ensure that _ITERATOR_DEBUG_LEVEL=0 is there
Go to C/C++ --> Code Generation --> Runtime Library . Here, ensure that Multi-threaded (/MT) is there

If you want code to be debugged, ensure that Project Pages --> Configuration Properties --> Linker --> Debugging --> Generate Debug Info is set to Yes

 

HIH

Ketan

thanks  @Ketan_LalchetaKetan_Lalcheta

 

After setting  _ITERATOR_DEBUG_LEVEL=0 ,

the error message decrease half, but still build failed.

exist error message:

protk_dllmd.libl : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in MFCLibrary1.obj

 

About setting "Runtime Library", if i set "Runtime Library" to (/MT)

the error generate:

>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\include\afxver_.h(81): fatal error C1189: #error : Please use the /MD switch for _AFXDLL builds

 

set1.jpgset2.jpg

Can anyone teach me How to set the environment of Visual Studio 2012 ?

I want to use the MFC C++ DLL .

ex: the _.lib which i need include? 

 

 

GabrielZaha
13-Aquamarine
(To:CAD_Jimmy)

MFC is only supported in asynchronous mode. That means toolkit DLL does not work with MFC.

If you need to develop a custom user interface that will connect with creo via the toolkit application I suggest to have a look at the ProUI* API's. Toolkit user guide describe those extensively and also there are some good examples under the "protk_appls" sub-directory.

thanks @GabrielZaha

 

Actually, toolkit DLL can work with MFC.

Firstly, I already finish the development of  toolki dll with MFC,

but when i want to add some external c++ open source code,

need to #include<vector>/<iostream> ,compiler is success, but build fail .(the error message is show in pic.

 

After a month study, i found a way that can make it run success:

1.change the Debug to Release mode

2. use MFC in a static library instead of use MFC in shared DLL

 

Announcements


Top Tags