Code Comments
Programming Forum and web based access to our favorite programming groups.I have MS Visual Studio 2005, on 32 bit WXP. I created a simple C++ application. It runs well and fast on my machine. However, when I copy the binary to another machine, I get the following error: The system cannot execute the specified program. This is silly. It is a trivial, commandline program intended for batch processing a few dozen files, using: FinanceCPP "C:\\Work\\rdata31.dat" "C:\\Work\\output31.txt" On my machine, that generates thousands of lines of output on standard out and creates a plain text file with an equal number of lines (a file a few hundred kBytes in size). When I created it, I selected File->New_project, and then, under Visual C++|General, I selected an empty project. Did I need to do anything else, in order to be able to just copy the resulting binary to any other machine (running, say, 32 bit WXP, or 64 bit Windows Server 2003)? I'd didn't worry about even looking for DLLs since I assumed any I'd need (such as the standard C library, and standard C++ library) would be part of Windows, or statically linked (since I did nothing special, using only a couple math functions and iostreams). I know the name of this group includes "dotnet", but in this specific case, I am just trying to use VC++ to compile a plain old ANSI standard C++ program (there's NOTHING in this that isn't part of the ANSI C++ standard). This isn't a language issue, but rather a what did I miss in the use of the MSVS IDE issue. I assume I have missed something simple, but I have yet to find what that is. Thanks, Ted
Post Follow-up to this message>When I created it, I selected File->New_project, and then, under >Visual C++|General, I selected an empty project. Did I need to do >anything else, in order to be able to just copy the resulting binary >to any other machine Change your project options to static link to the 'C' run-time library. The default is to use the DLL version of the library which means that you ought to install the VC++ run-time DLL as well as your EXE. By static linking the run-time you'll only need your EXE. The depends utility (www.dependencywalker.com) is an indispensable tool for working out what dependencies your programs have. Dave
Post Follow-up to this messageOn 17 avr, 21:21, Ted <r.ted.by...@rogers.com> wrote: > =A0I'd didn't worry about even looking for DLLs since I > assumed any I'd need (such as the standard C library, and standard C++ > library) would be part of Windows, or statically linked (since I did > nothing special, using only a couple math functions and iostreams). This is a wrong assumption : The C/C++ standard libraries come with the compiler, they are not part of Windows. The default option for Visual 2005 is to link against the DLL version of the CRT, which means that you must distribute the DLL with your application. If you want to link statically with the CRT (so that your app is self- containing), change the option in the project settings (Configuration Properties -> C/C++ -> Code Generation -> Runtime Library : Choose "Multithreaded" for Release configuration and "Multithreaded Debug" for Debug configuration) As David said, Dependency Walker is very usefull to diagnose quickly this kind of distribution problems. Arnaud
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.