Win32 based application problems

Win32 based application problems

Hi there, The code samples are only designed to work with MFC based projects. I am using a Win32 based project and the SDK includes are conflicting with the msvcrtd libraries, trying to redefine a load of stuff. Has anyone got a Win32 based project working with this SDK? Is it even possible? Many thanks, Andy
18 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

It's a problem with linking to the correct CRT library from what I can tell. Whenever I try and use any of the sample code I get loads of these compile errors:

MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: xxxxxxxxxxx already defined in LIBCMTD.lib(xxxxxxxxxx.obj)

I have tried changing from linking to static and dynamic runtime libraries. If I change to static I get the error 'cannot find MSVCR90D.dll try reinstalling' and if I link to the msvcrtd.lib then I get the same errors as I did before (error LNK2005)

Any help would be appreciated.

Many thanks,
Andy

Yes, Win32 is quite possible. An example of my stdafx.h:

#pragma once

#include "adpcppf.h" //includes all required C++ headers

#include "targetver.h"

#define WIN32_LEAN_AND_MEAN
// Exclude rarely-used stuff from Windows headers
// Windows Header Files:
#include windows.h

// C RunTime Header Files
#include stdlib.h
#include malloc.h
#include memory.h
#include tchar.h

Also try using (/MDd)

and /MD switch for Release project configuration. To set these options in VS - open project properties dialog -> C++ -> Code generation -> Runtime library -> Multi-threaded Debug DLL (/MDd) (for Debug configuration) or Multi-threaded DLL (/MD) (for Release configuration)

Hi,

Sorry for a late response, it's been Christmas and I've had other pressures on our application which forced me to put the Intel integration on a back burner.

It doesn't seem to matter how I set up the default libs, I always seem to get the same error, a load of:

MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: xxxxxxxxxxx already defined in LIBCMTD.lib(xxxxxxxxxx.obj)

Andy,

Check your include order.

An example of my stdafx.h:

#pragma once

#include "adpcppf.h" //includes all required C++ headers

#include "targetver.h"

#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files:
#include

// C RunTime Header Files
#include
#include
#include
#include

An example of my Compiler switches:

/Od /I "C:\Program Files\Intel\Intel Atom Developer Program SDK\0.9\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Gm /EHsc /RTC1 /MDd /Yu"stdafx.h" /Fp"Debug\EZScreeny.pch" /Fo"Debug\\" /Fd"Debug\vc90.pdb" /W3 /nologo /c /ZI /TP /errorReport:prompt

An example of my linker switches:

/OUT:"C:\atom\EZScreeny\Debug\EZScreeny.exe" /INCREMENTAL /NOLOGO /LIBPATH:"C:\Program Files\Intel\Intel Atom Developer Program SDK\0.9\lib" /MANIFEST /MANIFESTFILE:"Debug\EZScreeny.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"c:\atom\EZScreeny\Debug\EZScreeny.pdb" /SUBSYSTEM:WINDOWS /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:PROMPT adpcored.lib adpcppfd.lib psapi.lib shlwapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

Okay cool, thanks for the switches, I'll work through it and see how I get on.

Hi andy-russel,

Did you get the answer?

Just in case those details did not help you, please ensure you are using Visual Studio 2008.

Yes I have VS2008, thanks. The problem I think we have is we don't use a precompiled header in our app. We do have common headers but as you can imagine trying to rearrange includes in common files when they include core files too is pretty hard. I think this is why I am having these issues. It was never my decision to remove the precompiled header.

How much of an impact do you think this would have? Do you think it would be possible to resolve without the stdafx.h precompiled header?

Andy,

It is entirely possible.

Did you compare Command Line Switches above? What are you current compiler errors (if you have made changes)?

The switches are identical. If I don't include "msvcrtd.lib" which I notice you haven't, then my app compiles fine but comes up with the following error window...

This application has failed to start because MSVCP90D.dll was not found. Re-installing the application may fix this problem.

Is there another way around this other than including "msvcrtd.lib" ?

Andy,

You will want to include the appropriate CRT runtime in your MSI installer (via merge modules is the easiest way). If you do not, it will fail validation because of the missing resource.

This post may be of assistance as well: http://appdeveloper.intel.com/en-us/blog/2009/12/24/crt-runtime-policy-merge-modules-visual-studio-2008-package-and-deployment

I apologise if I'm sounding a bit stupid but the error message isn't to do with the resource not being linked in the deployment project, I haven't even got that far yet, this error appears in VS2008 when I compile the app and try to run it locally. Isn't the msvcrtd.lib the link to the resource? Which obviously needs to be included in the MSI but I have it on this machine, its just not linked correctly?

EDIT: this is where I am getting my info from, http://msdn.microsoft.com/en-us/library/abx4dbyh.aspx

Andy,

I wrongly assumed you were at the MSI stage.

Rather than retype it, here is a link which seems to address the issue you are having;

http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvc/thread/6c090997-57a6-4b16-a998-22af447cb253

BINGO!!!!!!

This has been the bain of my life for the past few weeks but now its working. I can't thank you enough!

No problem, if you need any further help don't hesitate to ask. Don't forget to check out the Blog section, there is a wealth of information accumulating there lately.

Leave a Comment

Please sign in to add a comment. Not a member? Join today