2

Recently we did some big architectural changes (i.e. mutlithreading support) to our cloud print module. Now I have to run a PreFast check on it, but because the current edition of Visual Studio 2008 that we are using does not have integrated PreFast check support, I have to do it through Windows DDK.

I am trying to build the source with WDK, but I am getting this error.

error LNK2005: "void _cdecl operator delete(void *)" (?3@YAXPAX@Z) already defined in libcmt.lib (delete.obj)

I believe that the linker used libcpmt.lib at a prior stage and it had the same definition for delete method. The source also has c files and cpp files mixed at different module levels. Could this be the real reason why it is using both libcmp.lib and libcpmt.lib in the first place?

Is there anyway i can fix this? I don't really need a "right" way. All i want is to build the source, so that i can run PreFast check (not really concerned about link related warnings). If it gives any PreFast warning regarding this, i can skip it for the time being.

Abdul Rahman
  • 2,097
  • 4
  • 28
  • 36
Anusha
  • 81
  • 2
  • Do you mean WDK or SDK? WDK is for drivers development and shouldn't be used for anything else. SDK is for apps development and contains the PREFast. See more here: http://stackoverflow.com/questions/888303/prefast-with-visual-studio-2008?rq=1 – SomeWittyUsername Oct 30 '12 at 13:31
  • I meant WDK. Anyways, when I used the macro USE_LIBCMT=1 in the sources files, I could build x64 solutions. But with the 32bit build, I am getting a new error. Instead of libcpmt.lib, now it is clashing with ntstc_libcmt.lib. There is no ntstc_libcmt.lib in x64 libs in DDK folder. It must be why there is no clash in the x64 build. I wonder how I can get rid of the ntstc_libcmt.lib file from the linking list of libs. I also could not get prefast to work with Pro version of Visual Studio from the link u gave me. – Anusha Nov 02 '12 at 02:55
  • Using the WDK is going to be very difficult and give you doubtful results. I would use the SDK as @icepack suggested. – Carey Gregory Nov 02 '12 at 15:35
  • @SomeWittyUsername: uhm you might want to check out the documentation for `TARGETTYPE` ... in fact the WDKs for Vista and Windows 7 (and prior to that starting from XP) where a stripped version of the very same build environment Microsoft is rumored to use (razzle). So *yes* the WDKs can be very much used for user mode programs and DLLs and static libs and everything else as long as you are happy with the limitations `build.exe` forces on you. – 0xC0000022L Mar 02 '16 at 20:51

0 Answers0