Skip to main content
GameDev.net gamedev.net
🔒 Locked

Running program from VC++ not same as normal [SOLVED]

Started by the_moo May 22, 2008 at 7:20 AM 4 replies 1.2k views
Original Post
the_moo
the_moo
Hi all, It's been a long while since I've been here but I'm in desperate need right now. I'm working on a game at the moment and all has been going well, but now I've hit a problem: For some reason, when I run my program from Visual C++ 2005 Express everything works normally as I intend it to. However, when it gets run as you normally would from explorer, there's one thing not being drawn. Everything else works, just one type of object won't draw to the window. Now I believe this is a matter of settings in Visual C++, but another program using the exact same functions and exact same files to draw with works in both cases... I really don't know what is happening and it's beginning to get frustrating because as far as I can tell it can't be a logic/math error since it works in one case and with no changes not in another. I appreciate any suggestions at all on how to fix this, Jonathan [Edited by - the_moo on May 22, 2008 10:21:51 AM]
the_moo
Red Ant
Red Ant
Hmmm this is just a wild guess, but do you have any resource files that your executable expects to be in a certain location? Beware that when running your program from within Visual Studio, your program's current working directory is (by default anyway) the project folder, whereas if you run it normally, the working directory is the directory containing your executable.
Matias Goldberg
Matias Goldberg
Quote:
Original post by Red Ant
Hmmm this is just a wild guess, but do you have any resource files that your executable expects to be in a certain location? Beware that when running your program from within Visual Studio, your program's current working directory is (by default anyway) the project folder, whereas if you run it normally, the working directory is the directory containing your executable.


That would be my first guess.
If that doesn't work, check that you don't have uninitialized variables somewhere. Sometimes (and you're unlucky) when running from MSVC those variables get initialized to 0 for you, while when being launched from an outside program they get screwed up (as it should happen actually).

i.e. This is an undefined behaviour:

int bDontDraw;

if( !bDontDraw )
Draw();

(Note that bDontDraw is never set to any value.)
Headkaze
Headkaze
When you say "one type of object won't draw to the window" it's pretty vauge. The only thing you can do is isolate the problem by breaking it down into pieces until you find exactly where the problem is occuring. By then you will most likely discover why it's not showing.
stonemetal
stonemetal
Try running the app from explorer then attaching the debugger.
the_moo
the_moo
Matias Goldberg, thanks so much!
I had thought about it being an external file issue but others were loading as they should so that couldn't be the problem.
I had actually tried to fix the problem that it turned out to be (show boolean was being set to "true" by MSVC by the looks of it) but in a different way that wasn't targeting the real problem but a break off of it.

Never knew Microsoft would do something like that - really doesn't seem to make sense.
Anyway, thanks Matias, I now know to be more careful with my initializing and look out for irregularities caused by MSVC "fixing" my problems.

Also, thank you all for the insanely quick replies - they are much appreciated!

Jonathan
the_moo

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.