Archived

This topic is now archived and is closed to further replies.

graveyard filla

why wont my program run alone but works in VC++

Recommended Posts

high, i have a mini text based rpg. i recently added a bunch of stuff (if the game works you will see if youve ever been to game tutorials.com) to the game and now, it compiles with 0 errors, and when i click run, it works perfectly. now, when i go to the folder its located, and find the .EXE, i click it, and in a millisecond the console window opens and closes. this happends every time i click, i cant get it to start. but if i go back to VC++ and click 'run', it works fine. anyone know what the problem could be? maybe its just on my end? heres the link to the game if you want to test it out for me http://dpunchprod.150m.com thanks [edited by - graveyard filla on January 25, 2004 5:04:12 PM]

Share this post


Link to post
Share on other sites
It''s because Microsoft Visual Studio automatically adds that "Click any key to exit..." at the end of any console app, while running the exe outside of Studio, it doesn''t have that feature. So you have to add it yourself, IE put a system("PAUSE"); at the end of your program.

Share this post


Link to post
Share on other sites
Could it be the paths? When you run from Viz it executes from the debug or release folder and uses the project folder as the current directory but when you double click the exe it uses that directory as current - perhaps some data is not being loaded?

Share this post


Link to post
Share on other sites
DUH!!! thanks trip, i dunno what the hells wrong with me. the map.txt file wasnt in the directory, but now it is and it works, dunno how i overlooked that.


enokh: thanks, but what are you talking about? dont want to run into the problem your talking about later on. do i have to add that, even tho its working now?> thanks

Share this post


Link to post
Share on other sites
Since it''s a text based rpg, there''s probably a game loop that runs until someone tells it to quit, right? Then it quits... shouldn''t be a problem with you, but if you wanted to do something right before quitting like displaying the message "Character saved" after the game loop right before exiting, you might want the System("PAUSE"). It''s in the stdlib.h library.

Basically, if you want to display something and end the program without asking for any user input, you''ll need System("PAUSE").

Share this post


Link to post
Share on other sites