So, I just recently started using VC. Before I had been using DevC++, gvim, and NetBeans(for java). The reason I got into Visual C++ is because I have also begun learning to use DirectX. I used Visual C++ 6.0 starter edition for a couple months, and then just a few days ago I got ahold of a copy of Visual C++ .NET. When I run my programs from within the visual environment, they run perfectly. However, if I run them by double clicking on their exe, they crash. At first I didnt think anything of it, since the stupid starter edition I started on always warned me it wouldn't let me make anything distributable. I had assumed this was its way of enforcement. But I noticed it as a problem when the problem continued with the full version, and realized that only applications using DirectX would crash. I am just completely baffled as to why my program would work perfectly within the environment, and not at all outside. I suspect I ahve some settings screwed up somewhere. Does anyone have any ideas? Thanks for the help. P.S. Just in case its relevent, I am using DirectX 8.0

Recommended Answers

All 8 Replies

It might be that you are linking with some dll's that aint in the folder you are executing from or in the system folder. try to look at the propeties for the project in VC and see if they link to some files. and if try to copy them into the program's folder and execute.

It might be that you are linking with some dll's that aint in the folder you are executing from or in the system folder. try to look at the propeties for the project in VC and see if they link to some files. and if try to copy them into the program's folder and execute.

The only includes in my file are to the standard libraries that come with the IDE, and the directX libraries that installed themselves and VC configured itself to use, and nothing else is being linked to the program. I even checked how it configured itself, and there were no errors as far as how i was instructed to set it up. Just for the hell of it I did move the included files into the folder intself and nothing changed, so I put them back. And BTW, I upgraded to DirectX 9.0 and am having the exact same problem, so I didn't have a faulty or out of date install of the 8.0 version.

I've heard of problems with MSVC++ 6.0, where everything runs fine when you're just running it from MSVC, but when you go to run it in its release/debug folder it crashes. If the program was a missing dll then an error message should pop up when you try to run the program.

I don't have a copy of MSVC handy to make sure that this is where you should go, but there is a place to check which dlls are being linked from. Check in tools->options directories tab for any place that the program is looking for dlls..?

-Fredric

ooo, sounds like a promising lead. I shall try this very shortly. I get no actual error messages when it crashes, since the Just-In-Time-Debugger thing pops up and stops it...but hopefully this will still fix it...

Woops, I just checked to see if that was right, and apparently you can't specify a dll directory with MVC++ 6.0. Sorry for the bad info!

I have done Direct X stuff before, but what you are saying has never happened to me before. Maybe post some code of what isn't working so that we can try it out and see if it is the code or your machine?

-Fredric

hehehe, im feeling like bashing my head into the wall right now:-d I did not make a single change to my code, but I started fiddling with the project settings and the VC's overall settings. Sadly though my university I study at loves to teach me languages and programming techniques, they feel they dont have to get into the nitty gritty mechanics behind a language until VERY late, so nearly all the settings were greek to me:( I turned on a few compiling optimization setting ...and suddenly my program no longer crashed while running in a free environment...it simply opened, changed the screen resolution to 640 x 480 like its supposed to...and then exits back to windows... arg! lol. And now to make things worse, somewhere in changing the other prefs it made it so that when running in VC, where it used to work perfectly, it now locks up when I hit the key that tells my windows event handler to quit the application -_- I'm thinking of removing VC and DirectX from my computer and reinstalling, just in case something is bogus there... So anyways, as far as posting code for others to look at, how would I go about doing that? It requires 3 bitmaps and 12 source files along with their headers to run. I got quite far in the project before I found my *little* problem:-/

So anyways, as far as posting code for others to look at, how would I go about doing that? It requires 3 bitmaps and 12 source files along with their headers to run.

Probably a dumb question, but are you sure that those bitmaps are in the right place with respect to the .exe file that you are running?

Here is a link to an faq on gamedev.net that covers DirectX 9.0 and VS 6.0, apparently it isn't supported anymore.

http://www.gamedev.net/community/forums/showfaq.asp?forum_id=10#troublecompiling

And here is a bit from MSDN saying that you have no hope for support with VS 6.0 and DirectX 9.0.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/directsdk/ProgrammingGuide/programcpp/programcpp.asp

I would say get an older version of DirectX, or get .NET (which I wouldn't recommend blowing the money on).

-Fredric

um...here is where I feel very very stupid:-d I've not dealt much with distributables, so even when using IDE's like DevC++ and NetBeans, as long as it executed when I compiled things were fine. And I've only been formally taught anything using gvim and the like, where projects and the like were self managed. So this lead me to using relative pathnames to things like the bitmaps in my code, but not including the said bitmaps into the project. so when i run from within the environment it knows where to find them and runs just fine...and when it creates a distributable, it does not include the bitmaps and the whole thing goes to hell when you try to run it... So ya! I've just learned what I should already know, and I thank you profusely for helping me do that! It is MUCH appreciated!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.