Jump to content
  • Advertisement
Sign in to follow this  
Kiristu

EXE OK within Visual C++ but crashes outside

This topic is 4418 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I'm working with Visual C++ 2005 Express to compile and run my application. No problem when I launch from the run button in Visual, but when I try to launch it directly by double-clicking on the .exe file, it crashed with a basic Windows error saying the application encountered a problem and must close. It could be caused by some compiler settings by I don't know which ... Any idea ? Thank you, K.

Share this post


Link to post
Share on other sites
Advertisement
Maybe some files that you load inside your program are missing. Your program can't find them and you haven't done error checking(program continues executing without them).
Probably are your data files somewhere in sources dir, but are missing in debug dir.
Use full paths when you load your data.

Share this post


Link to post
Share on other sites
Thanks for your answer, but that is not the problem:

I modified my code to have:



int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
return 0;
}




And the error is still there !

SO the program does not have to do anything else than to quit ...

K.

Share this post


Link to post
Share on other sites
Is that *all* your program does? There's no global classes or anything? What do youy mean it crashes? What error do you get?

Share this post


Link to post
Share on other sites

int main()
{
return 0;
}




has the same result ...

It crashes = pop-up window with a message saying my exe encountered a problem and must close, with buttons to send the error report or not (also a link with click here to access the report details, but nothing I can understand in it).

Of course, my application does have a lot of global classes, but having said that, why can it work differently in Visual than from exe file ?

Thanks,
K.

Share this post


Link to post
Share on other sites
When he said global classes he meant global instances of those classes. That is, do you have global variables that are going to be constructed and destructed (in essence doing more than just a return 0)? If you do, then that's where the problem lies: it's probably a constructor trying to load a file or DLL that isn't in the right directory.

Share this post


Link to post
Share on other sites
OK, that could be the problem.

Since I can know the dll I include in the project via the compiler/project settings, how can I specify the "path" ?

It's a DirectX application (with DX specific global classes), so I need a number of external files, I thought the executable file "knows" where it has to look for them ...

Thanks,
K.

Share this post


Link to post
Share on other sites
Executable file "knows" to look for dlls in same path where the executable itself lies, "c\windows\", "c:\windows\system\" and "c:\windows\system32\".

Share this post


Link to post
Share on other sites
I've never seen int main() work in a Win32 project. If you had WinMain you cannot replace it with main() and have it still compile in VS. It's never worked when I've done it. Could something else be up?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!