Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Using simple C++ programs on other pcs

Options
  • 17-07-2007 7:27pm
    #1
    Registered Users Posts: 677 ✭✭✭


    Hey,

    I have a very simple C++ program done on microsoft's visual studios,
    I'm using Microsoft Visual C++ 2005 Express Edition.
    I have become aware of a .exe file created in the debug and release directories of the solution whenever I build the code.

    This seems a very useful way to run the program, and I can also move the executable file out of its directory, say to the desktop, and it will still work. But if I copy it to another computer it wont work!

    I expect it has something to do with the included files using:
    #include <>

    In this file I include iostream, iomanip and fstream.
    I'll attach the code, and executable file for example.

    So any info on how to use this program on another computer would be brilliant, Im sure its probably really simple... lol! :D


Comments

  • Closed Accounts Posts: 17,208 ✭✭✭✭aidan_walsh


    Worked fine on mine.


  • Registered Users Posts: 677 ✭✭✭M450


    Worked fine on mine.
    So you just ran the .exe and it worked? ... didnt on my home pc!
    would you need the platform SDK installed on the pc maybe?


  • Closed Accounts Posts: 17,208 ✭✭✭✭aidan_walsh


    So you just ran the .exe and it worked?
    Well, I scanned it first to make sure you weren't being a git :)
    would you need the platform SDK installed on the pc maybe?
    I don't have it. Nor should you need to, you're only using standard C++ libraries. The platform SDK only relates to Windows specific stuff.

    You don't happen to have a 64bit processor at home, do you? It shouldn't matter, but if the binary was built for a 32bit machine, it may refuse to run on a 64bit one.


  • Registered Users Posts: 677 ✭✭✭M450


    The error I get on my home pc is:

    The application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.

    pretty vague!! :confused:


  • Registered Users Posts: 2,931 ✭✭✭Ginger


    Just checked it on my machine and it worked but then again I have VS2005 Pro for Software Devs

    More than likely its WinCRT thats the issue here..

    Try this http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=164465&SiteID=1
    OK, due to popular demand, and my frustration with seeing so many people using Express that simply want to run an app on another machine, without the hassle of learning about merge modules, Windows Installer, etc, etc, etc, here is a way to perform deployment option number 2 above (i.e. installing C Runtime library applocal) for Express.

    1) On the machine you have Express installed, create the following folder and subfolders in your
    \program files\microsoft visual studio 8\VC folder:

    redist\x86\Microsoft.VC80.CRT

    2) Copy msvcr80.dll, msvcp80.dll, msvcm80.dll from
    \windows\winsxs\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_0de06acd

    into:

    \program files\microsoft visual studio 8\VC\redist\x86\Microsoft.VC80.CRT

    3) in the above Microsoft.VC80.CRT folder, create a new file named:

    Microsoft.VC80.CRT.manifest

    4) Paste the following content into the above manifest file:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <!-- Copyright © 1981-2001 Microsoft Corporation -->
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <noInheritable/>
    <assemblyIdentity
    type="win32"
    name="Microsoft.VC80.CRT"
    version="8.0.50608.0"
    processorArchitecture="x86"
    publicKeyToken="1fc8b3b9a1e18e3b"
    />
    <file name="msvcr80.dll"/>
    <file name="msvcp80.dll"/>
    <file name="msvcm80.dll"/>
    </assembly>

    Now you have a new folder in your Visual C++ Express installation that can be re-used when ever you need it.

    To deploy these files, simply copy the Microsoft.VC80.CRT folder you just created to your program folder. That's it. So for example, if your application executable resides in C:\Program Files\MyApp, you'll have a folder named:

    C:\Program Files\MyApp\Microsoft.VC80.CRT

    that contains the 4 files I mentioned (3 DLLs and one manifest file you created by hand)

    No installation of anything else is necessary. Just click on your EXE file, and your app will run. No special installation engines are necessary, just make your setup program (installer) create that subfolder Microsoft.VC80.CRT along with what you normally install with your app)

    Let me know if you need similar instructions for MFC and I'll create them.



  • Advertisement
  • Registered Users Posts: 5,335 ✭✭✭Cake Fiend


    Have you tried another compiler?


  • Registered Users Posts: 1,275 ✭✭✭bpmurray


    You need MSVCP80.dll and MSVCR80.dll to run your program - are they in the target computer?


  • Moderators, Music Moderators Posts: 1,481 Mod ✭✭✭✭satchmo


    I've seen that error with executables built with Visual Studio SP1, have you installed any visual studio service packs by any chance?


  • Registered Users Posts: 2,931 ✭✭✭Ginger


    Its a Visual C Runtime issue. The main thing is that the Express edition expects you to have the files on the machine. If you created an installer for it, it would have had the bootstrapper check for the neccessary files.

    In this case I am guessing that the VCRT_redist hasnt been deployed to the second PC..

    The code is standard nothing complex


  • Registered Users Posts: 81,879 ✭✭✭✭Overheal


    I get the similar issue in Borland C++ : you cant run the executable on another machine and its frustrating as hell


  • Advertisement
  • Registered Users Posts: 5,335 ✭✭✭Cake Fiend


    I'm no C++ expert, but I don't see anything in that code that (by itself) should need any external DLLs (I hear VS is a bugger for adding on all sorts of sh1te).

    Try compiling this in something like Dev-C++ and see how you get on.


  • Users Awaiting Email Confirmation Posts: 351 ✭✭ron_darrell


    Cutting and pasting an exe won't necessarily mean that that the exe will run (try it with any of your programs or games - something not already installed of course). For very simple programs (e.g. hello world!) it will run 9 times in 10 for anything more active probably 1 in a 100. The problem as others have suggested is with .dlls and other associated files (e.g. .ocx a prog of mine ran fine on all the win98 machines in the office (this is a few years back) but not on the newer win2k machine due to an issue with Msmapi32.ocx. You really do need an installer to get the same results on machines other than the development one (the installer will not only 'copy' the exe but all associated and required .dll and .ocx and all other files)

    -RD

    P.S. For the borland fans, my first C++ dev environment was Borland. It was a nightmare for me as the machine I was developing on had winNT (this is a great many years back) and my home machine was win98. Had to recompile each time I wanted to check my progs at home. Definitely proved the copy and paste thing didn't work. Royal pain in the butt. That said I really missed some of the functions I had in Borland that weren't available in the Visual Studio environment when I changed over. Can't have it everyway I guess.


  • Registered Users Posts: 10,385 ✭✭✭✭dulpit


    I just downloaded it, and it runs perfectly...


Advertisement