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
Hi all,
Vanilla are planning an update to the site on April 24th (next Wednesday). It is a major PHP8 update which is expected to boost performance across the site. The site will be down from 7pm and it is expected to take about an hour to complete. We appreciate your patience during the update.
Thanks all.

Visual Studios C++ game

Options
  • 22-04-2007 2:22pm
    #1
    Registered Users Posts: 677 ✭✭✭


    Hey,

    I have been using c++ for about 2 years now in college and our latest project was to write an arcade style retro shooter game such as space invaders etc.
    We are using Microsoft Visual Studios 2005 Express Edition, and using the platform SDK, and quite a bit of SDL.
    I would like to know how to create an executable for my game, so it can be played on any computer... without the need to play using the visual studios program.
    I assume that all the additional dependencies such as SDL.h and SDL_Image.h and others that I include in the code will have to be copied into the same directory as the source code, or something like that... I also have a few .gif images and .wav sound files, and a txt file for recording the high score.

    any words of wisdom would be greatly appreciated!! :D

    As well as this, I've also heard that it is possible to save the game to my (well, my little brother's) PSP which sounds brilliant! Any info about this would also be great!

    Thanks,
    DM

    currently in my source code directory:
    4 .cpp files
    2 .h files
    a few .gif images
    a few .wav sound files
    3 .ttf fonts
    1 .txt file for high score


Comments

  • Closed Accounts Posts: 461 ✭✭markf909


    Im pretty sure the Express Edition of Visual Studio does not allow .exe files to be built.

    If your code is standard C++, then you should be able to compile it ok with gcc (search for MinGW on Windows).

    You can link in the SDL libraries by using the -lSDL flag when compiling.


  • Registered Users Posts: 9,579 ✭✭✭Webmonkey


    As markf909 said you cannot compile to .exe with the Express edition (as far as i know anyways) though when you do run and debug isn't a .exe file created temporairly somewhere, you could catch this?

    All you have to do is find a C++ compiler, maybe something like DevCPP (google it) - you might have to specify where the libraries are and stuff but with a bit of work you'll get what you want.


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


    I don't think that's true at all, as far as I know Express Edition produces an executable... have you looked in your [project]\Debug or [project]\Release folders to see if there's one in there?


  • Closed Accounts Posts: 461 ✭✭markf909


    I just had a quick look at my C# express edition and it seems that the .exe does persist in the bin\Debug folder of the project :D


  • Registered Users Posts: 677 ✭✭✭M450


    I did find a .exe with the name of my project in the debug and release folders but they fail to execute, the good 'ol error message pops up sayin: this program has encountered a problem and needs to close, sorry for the inconvenience.

    Although in saying that the .exe for my previous much simpler project did run properly, there were only 2 .cpp files and no other resources. I believe it also failed to run when opened on another computer! So the platform SDK may have to be installed on the computer for it to run... maybe...:confused:


  • Advertisement
  • Registered Users Posts: 677 ✭✭✭M450


    I have succeeded in enabling my game 2 be run as a .exe once it is located in the same directory as all the .gif and other files required to play the game...

    This is useful as i now have a shortcut to my game on the desktop :)

    But, i tried copying the folder containing the .exe and all resources onto another computer and it wont work...

    I even tried it with all the SDL libraries and header files and dlls in the same directory in case it was a linking problem, (since in Visual Studios you link to the folder with all the SDL files...)
    but with no luck!!

    So what does this mean... :confused: is visual studios not able to produce a program that can be distributed to other computers?

    any ideas?

    thanks,
    DM


  • Registered Users Posts: 2,426 ✭✭✭ressem


    Visual studio can of course produce programs that can be used on other computers. However, this may not be as easy as copying just the exe and gifs.

    If there are dependencies used which are typically not on another computer, such as SDL runtime librarys, then usually you would add a setup project to your solution.
    (File/New/Project/Other project Types/ Setup and deployment). Then select the SDL runtime, the files generated by the compiler, gifs etc.

    This would create a group of files which, when transferred and installed on another PC should include everything necessary.


  • Registered Users Posts: 6,487 ✭✭✭daymobrew


    M450 wrote:
    But, i tried copying the folder containing the .exe and all resources onto another computer and it wont work...
    What was the error message?


  • Registered Users Posts: 677 ✭✭✭M450


    the error was something like,

    this application is not configured properly, try reinstalling it...


  • Registered Users Posts: 6,487 ✭✭✭daymobrew


    M450 wrote:
    the error was something like,

    this application is not configured properly, try reinstalling it...
    I was hoping that it would list a DLL that it couldn't find. Maybe you could zip and attach the executable here and we could have a look at the DLLs it is looking for (dumpbin /imports <exe-name>).


  • Advertisement
  • Closed Accounts Posts: 3,285 ✭✭✭Smellyirishman


    OK, you're in luck :p.

    I too worked on a game for my 3rd year project and, unfortunately, I too picked VC++EE as my IDE. What you want to do is possible, but they make it a pain in the arse.

    First you will need to compile as a release.
    Then you will need to build a redistribution MSI file which will have to be installed on the foreign computer before you run the release exe.

    Have fun!


Advertisement