Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / April 2008

Tip: Looking for answers? Try searching our database.

Problem deploying binary

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ted - 17 Apr 2008 20:21 GMT
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
David Lowndes - 17 Apr 2008 22:55 GMT
>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
adebaene@club-internet.fr - 18 Apr 2008 09:35 GMT
>   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).

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
Ben Voigt [C++ MVP] - 21 Apr 2008 18:34 GMT
Your question has already been answered, so I'll address this bit:

> 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.

The correct group would have been
microsoft.public.vc.language

> I assume I have missed something simple, but I have yet to find what
> that is.
>
> Thanks,
>
> Ted

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.