First a bit of context. I’ve been programming professionally in C since the late 1980’s for Unix and Linux, but have negligible exposure to the Window development environment. The last time I dabbled (correct word) with C on Windows was in the VC5 timeframe.
I’ve downloaded the VC2010 Express installer, installed it (96MB download), and updated it with the Windows Update security patches (266MB download). [Rhetorical aside, how is it even POSSIBLE to have 266MB of security patches to a 96MB software product?!]
I loaded the PDK 2.3.5 example project “solution”, left it in the Debug(Win32) configuration, and in the project properties added include directories “{blah}/src” and “{blah}/src/support”, added library directory “{blah}/lib”, told it not to use pre-compiled headers, and changed the library dependency reference from “corelib.dll” to “corelib32.dll”. I also told the project not to use the resource file, since the afxres.h it depends on isn’t present.
This gets me through compiling the sources, but at the linking stage I have a couple of issues. There’s a warning about a conflict between /INCREMENTAL and /LTCG that I’m presently ignoring. There’s a hard error involving inconsistent values for _ITERATOR_DEBUG_LEVEL (0 versus 2) that I don’t know how to deal with.
I’d appreciate any guidance, suggestions or handholding so I can actually build the PDK examples properly.
Hi there,
Luckily this has an easy solution: The problem is that the World Machine libraries are compiled in Release mode, which is incompatible with Debug builds. You have two choices:
- Always build in release mode instead – this works but makes debugging your plugins harder, or
- Make your debug builds use the release version of the C runtime – for your project, go to Properties -> C++ -> Code Generation and change the Runtime Library to Multi Threaded.
The above should get you up and running. I’ve been meaning to change the project settings so that #2 above is implemented by default and Debug builds work successfully; I will see what I can do to make this a smoother start in the future.
Thank you, Stephen. I will give it another shot this weekend.
Sunday update: The first technique (using Release) works just fine. The 2nd technique does not. In C/C++ > Code Generation > Runtime Library I have four options plus inherit from defaults: Multi-threaded, Multi-threaded Debug, Multi-threaded DLL, Multi-threaded Debug DLL. The one which comes closest to working is Multi-Threaded Debug, which gives the _ITERATOR_DEBUG_LEVEL errors:
PluginCore32.lib(Device.obj) : error LNK2038: mismatch detected for ‘_ITERATOR_DEBUG_LEVEL’: value ‘0’ doesn’t match value ‘2’ in DLLExample.obj
If I select Multi-Threaded, I get those errors plus some others, notably unresolved symbols __malloc_dbg, __calloc_dbg, __free_dbg, and __CrtDbgReportW. Since this is Microsoft, I’m reluctant to assume they even have the same API as the standard versions, or I would write wrappers for them.
I will proceed with a Release configuration.
Updating with my recent tryout of the WM3001_PDK. Basically the same issues as previously discussed.
I tried something different this time. Rather than deal with the missing afxres.h by excluding the Example Devices.rc resource file from the project, I edited the resource file to use “windows.h” instead of “afxres.h”. That was a solution for VC 2010 Express that showed up in several places on the Web.
I also re-tried all four options for Configuration Properties > C/C++ > Code Generation > Runtime Library in the Debug configuration, and none of them worked. (No problem with the Release configuration.) The closest match was Multi-threaded Debug (/MTd), but it still generates complaints like
PluginCore32.lib(any.obj) : error LNK2038: mismatch detected for ‘_ITERATOR_DEBUG_LEVEL’: value ‘0’ doesn’t match value ‘2’ in DLLExample.obj
If you could include a debug version of the PluginCore32.lib in future SDK’s, that would be helpful and much appreciated.