views:

422

answers:

1

Hi,

When I compile my Visual c++ 2008 express program from inside the IDE and redistribute it on another computer, It starts up fine without any dll dependencies that I haven't accounted for. When I compile the same program from the visual c++ 2008 command line under the start menu and redistribute it to the other computer, it looks for msvcr90.dll at start-up.

Here is how it is compiled from the command line

cl /Fomain.obj /c main.cpp /nologo -O2 -DNDEBUG /MD /ID:(list of include directories) link /nologo /SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup /OUT:Build\myprogram.ex e /LIBPATH:D:\libs (list of libraries)

and here is how the IDE builds it based on the relevant parts of the build log.

 /O2 /Oi /GL /I clude" /I (list of includes) /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D    "_UNICODE" /D "UNICODE" /FD /EHsc /MD /Gy /Yu"stdafx.h" /Fp"Release\myprogram" /Fo"Release\\" /Fd"Release\vc90.pdb" /W3 /c /Zi /TP /wd4250   /vd2

Creating command line "cl.exe @d:\myprogram\Release\RSP00000118003188.rsp /nologo /errorReport:prompt"

/OUT:"D:\myprgram\Release\myprgram.exe" /INCREMENTAL:NO /LIBPATH:"d:\gtkmm\lib" /MANIFEST /MANIFESTFILE:"Release\myprogam.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"d:\myprogram\Release\myprogram.pdb" /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /LTCG /ENTRY:"mainCRTStartup" /DYNAMICBASE /NXCOMPAT /MACHINE:X86 (list of libraries)

Creating command line "link.exe @d:\myprogram\Release\RSP00000218003188.rsp /NOLOGO /ERRORREPORT:PROMPT"

/outputresource:"..\Release\myprogram.exe;#1" /manifest

.\Release\myprogram.exe.intermediate.manifest
Creating command line "mt.exe @d:\myprogram\Release\RSP00000318003188.rsp /nologo"

I would like to be able to compile it from the command line and not have it look for such a late version of the runtime dll, like the version compiled from the IDE seems not to do. Both versions pass /MD to the compiler, so i am not sure what to do.

A: 

I know it is not exactly what you are looking for but you can invoke the ide build form the command line and it should give you the same output:

devenv solution.sln /build Release

This will build the Release configuration for solution.sln. (devenv /? on the command line for more info).

Dolphin
well, that is useful information in and of itself, but I am using Scons to create a multi platform build. I could use Scons to invoke devenv but then I would have to add a source file to the visual c++ project every time I add one to the Scons file. Ideally, I would like to be able to pass the right arguments to the compiler and linker.
Stanley kelly
I guess I got the impression from your question that your main development environment was the IDE. It soudns like this is not the case. Still probably not ideal but maybe your build tool could generate the project file?
Dolphin