how to build an c++ executable that can be run on another computer
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: how to build an c++ executable that can be run on another computer

  1. #1
    Join Date
    Jul 2010
    Posts
    8

    Exclamation how to build an c++ executable that can be run on another computer

    Hi -
    I have a small console app that takes two arguments from the command line, sorts through the text in the file specified by the first argument, picks out bits of information and throws it into a file specified in the second argument. I wrote the c++ code and everything is working alright on the build machine(the computer with MS Visual C++ Express 2010 on it. But i want to make an executable that another computer can execute without having to install anything on the second computer. I work in an office building so the computers that this program will run on are all standard builds (i.e. optiplex 760 and etc.). They have .NET framework v1.0.3705, 1.0 Hotfix, .net 1.1 security update, .net framework 2.0 service pack 1 and .net framework 3.0 service pack 1 installed on them. So far i've built a release version of my code in MSVC++ added msvcp100.dll and msvcr100.dll to the directory and copy/pasted it onto the new computer. I get this error message:

    "To run this application, you first must install one of the following versions of the .NET framwork: v4.0.30319 Contact your application publisher for instructions about obtaining the appropriate version of the .NET framework"

    It's a hassle to install anything on these office computers, so is there a way to build the simple c++ program i wrote to make it utilize the .NET framework version(s) that are already on the computer?

  2. #2
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,632

    Re: how to build an c++ executable that can be run on another computer

    I don't have VS2010 installed so unless you find an option to build for .net 3 you have to switch to using VS2008 instead (it was still downloadable last time I checked).
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    http://www.microsoft.com/visualstudio/eng/downloads

  3. #3
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    5,930

    Re: how to build an c++ executable that can be run on another computer

    so is there a way to build the simple c++ program i wrote to make it utilize the .NET framework version(s) that are already on the computer?
    First of all, c++ programs that utilizes .NET frameworks are discussed in another forum related to managed c++.

    Second, VS2010 is claimed by MS to be able to support any .NET framework ever released before, so it's very probable you merely have to make corresponding changes in your project settings regarding target framework.

    Third, you cannot expect to build with the most recent VS and have the resultant executable running with no problem in any system. People typically distribute programs in form of installation packages, when installer solves dependencies. Otherwise, they build with VC++6 or VC++7.

    And the last thing. "Simple c++ program that utilizes .NET framework" tells me nothing. It's always good to see some code sample, ready to build if possible.
    Best regards,
    Igor

  4. #4
    Join Date
    Jul 2009
    Location
    India
    Posts
    835

    Re: how to build an c++ executable that can be run on another computer

    I dont know about VC++ 2010, but if it would be about VS08 then using /MT at the RunTime Library from project settings can make your application run on any computer.

  5. #5
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: how to build an c++ executable that can be run on another computer

    Are you using the .NET framework? Looks like this is a C++/CLI program, not C++. If you don't want the managed components, create a simple Win32 Console Application project. You'll still need the C runtime library (msvcrXX.dll) and C++ runtime library (msvcpXX.dll) (XX stands for the right version) on the target machine, but you can put them in the same folder with your application.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  6. #6
    Join Date
    Jul 2010
    Posts
    8

    Exclamation Trying to execute a VC++ 2008 build on another computer

    Hi -
    I made a build of a working program in VC++ 2008 on a computer with .NET framework 2.0 service pack 2, .NET framework 3.0 SP2, .NET Frmwrk 3.5 SP1, and .NET 4.0. I want execute this program on standard office computers (every computer comes with the same software loaded on them and they don't change often). The computers have: .NET Framework v1.0.3705, .NET 1.1, .NET 2.0 SP1, and .NET 3.0 SP1. Is there a compatibility issue here? And if so, what should i do?

  7. #7
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,632

    Re: Trying to execute a VC++ 2008 build on another computer

    If you're building a native C++ application you either have need to install the VC9 runtime on each target machine or link your application statically.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    http://www.microsoft.com/visualstudio/eng/downloads

  8. #8
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Trying to execute a VC++ 2008 build on another computer

    [ merged threads ]
    @rylar, please don't create multiple threads for the same topic.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center