compiling in release mode = nogo

Started by
4 comments, last by fireking 21 years, 7 months ago
I compile my program in debug mode (there by default), and it runs smoothly. I compile in release, and it crashes as soon as it opens. Im doing heavy amounts with type casting and the Win32 GDI. Does anyone know what would cause the app to crash as soon as it opens when i compile in release? Random C++ Fear: Putting information into a String! --Fireking Owner/Leader Genetics 3rd Dimension Development
--FirekingOwner/LeaderFiregames Development &Blackdragon Studios
Advertisement
You could try going through your code and taking a look at any blocks of code defined only in release mode (#ifndef _DEBUG), but I would use MessageBox or OutputDebugString to check what''s wrong.

Write your own TRACE-like macros that output text using OutputDebugString and use DebugView to view that output (you''ll need Administrator access to run DebugView). Do simple traces at first, something like this: TRACE("in WM_PAINT\n"). That way you''ll have some idea where the crash occurs and can add more TRACE macros in the appropriate place.

After you''ve fixed the problem, you can redefine your macros to do nothing.

I think you can also enable debug information in Release mode so that you can step through your code. The setting should be "Debug info" under the C/C++ tab in Project Settings (Alt+F7).

well that is sort of a problem

i dont have any freaky macros or anything, its just a regular application that runs a little demo that i created using the Win32 GDI. Fairly simple. Btw, this happens on ALL of my win32 gdi projects.

I am using PeekMessage() and Sleep() and most common Gdi Functions.

do you know if any of those can cause this sort of behavior?

and can you tell me the difference between compiling the debug and the release, because the debug.exe works just great.

--Fireking

Owner/Leader
Genetics 3rd Dimension Development
--FirekingOwner/LeaderFiregames Development &Blackdragon Studios
bump

--Fireking

Owner/Leader
Genetics 3rd Dimension Development
--FirekingOwner/LeaderFiregames Development &Blackdragon Studios
In debug mode all your pointers are initialized to null by default. However in release mode this is not the case, pointers grab some random address and well that usually causes alot of problems.

So most likely you''ve just got a pointer that''s pointing to some invalid memory. The way to find out what''s happening is to set a breakpoint in your code and see where it''s crashing. Then go back again and see what the values of your variables are at the moment of the crash.
Reread my post. The macros are to be added to aid in debugging. AP also has a very good point.

This topic is closed to new replies.

Advertisement