Compiling release version in microsoft visual c++ 2010

Started by
14 comments, last by Ussyless 13 years, 2 months ago
Unitialised variables tend to be the biggest issue when I'm unable to run a release version.

Also, it's not quite as simple as just selecting Release mode. If you have linked other libraries in the debug version (OpenGL, etc) then you will need to make sure you have the same Linker options in Release mode.
Advertisement
MSVCP100.dll = Release mode dll file
MSVCP100D.dll = Debug mode dll file

If your friend is still getting the error with MSVCP100D.dll, you are not compiling with release mode, unless your statically linking to the dll in your code (as someone else mentioned above)
I think you may be dealing with 2 completely different issues here.
here is complete output when compiling

'SpaceSpeedster.exe': Loaded 'C:\Documents and Settings\kieran\My Documents\Visual Studio 2010\Projects\SpaceSpeedster\Release\SpaceSpeedster.exe', Binary was not built with debug information.
'SpaceSpeedster.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', Cannot find or open the PDB file
'SpaceSpeedster.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', Cannot find or open the PDB file
'SpaceSpeedster.exe': Loaded 'C:\Program Files\Alwil Software\Avast5\snxhk.dll', Cannot find or open the PDB file
'SpaceSpeedster.exe': Loaded 'C:\WINDOWS\system32\user32.dll', Symbols loaded (source information stripped).
'SpaceSpeedster.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll', Cannot find or open the PDB file
'SpaceSpeedster.exe': Loaded 'C:\WINDOWS\system32\opengl32.dll', Symbols loaded (source information stripped).
'SpaceSpeedster.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll', Symbols loaded (source information stripped).
'SpaceSpeedster.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll', Cannot find or open the PDB file
'SpaceSpeedster.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll', Cannot find or open the PDB file
'SpaceSpeedster.exe': Loaded 'C:\WINDOWS\system32\secur32.dll', Cannot find or open the PDB file
'SpaceSpeedster.exe': Loaded 'C:\WINDOWS\system32\glu32.dll', Symbols loaded (source information stripped).
'SpaceSpeedster.exe': Loaded 'C:\WINDOWS\system32\ddraw.dll', Symbols loaded (source information stripped).
'SpaceSpeedster.exe': Loaded 'C:\WINDOWS\system32\dciman32.dll', Symbols loaded (source information stripped).
'SpaceSpeedster.exe': Loaded 'C:\WINDOWS\system32\glut32.dll', Binary was not built with debug information.
'SpaceSpeedster.exe': Loaded 'C:\WINDOWS\system32\winmm.dll', Symbols loaded (source information stripped).
'SpaceSpeedster.exe': Loaded 'C:\WINDOWS\system32\shimeng.dll', Symbols loaded (source information stripped).
'SpaceSpeedster.exe': Loaded 'C:\WINDOWS\system32\imm32.dll', Symbols loaded (source information stripped).
'SpaceSpeedster.exe': Unloaded 'C:\WINDOWS\system32\shimeng.dll'
First-chance exception at 0x00401a02 in SpaceSpeedster.exe: 0xC0000005: Access violation reading location 0x5913b07e.
Unhandled exception at 0x00401a02 in SpaceSpeedster.exe: 0xC0000005: Access violation reading location 0x5913b07e.



also yewbie, if you read that much you should have also seen
i should say i tested all the multithreading options, i guess that error is just from when i tested the debug one, the other ones came up with the similar error "MSVCP100.dll"

the linkers are the same for the debug & release also

dont think i've left anything undefined


what a paint this is >.>
OK, since i'm desperate, I've attached my source files, if anyone could tell me whats wrong, i'd be grateful (you may have to change some of the includes to your directories)
kinda new to c++ but i have experience in other languages, just gotta get used to this one, so i know some of my scripts might be a bit inefficient but thats not a problem for now.
thanks
will remove these files if/when this is solved

EDIT: sorry forgot to attach lol, they are on now
EDIT2: seems to be solved, removed the download thanks pomnico

OK, since i'm desperate, I've attached my source files, if anyone could tell me whats wrong, i'd be grateful (you may have to change some of the includes to your directories)
kinda new to c++ but i have experience in other languages, just gotta get used to this one, so i know some of my scripts might be a bit inefficient but thats not a problem for now.
thanks
will remove these files if/when this is solved


What I have found after few moments:
- debug::pop - you declare line[20] but inside this method you try to set line[20] = line[19] (for i = 20)
- debug::draw -You are not calling delete on "a" varable. Why not passing to draw_string function "s.c_str()" directly?

Sorry, but I can't launch it atthe moment, so I would just give you short advice on how to look for such problems (in case of simple programs, like yours). Use printf to log current position in your program:
printf("LOG: %s(%d) : %s\n", __FILE__, __LINE__, __FUNCTION__);
Put it at the beginning of main and at end of main for start, as well as in the same way inside all callback functions registered to glut - display, keyboard, reshape, etc.
Run your program and look at end of log. If you see that program has entered inside some function, but has not returned from it when it has crashed, just tighten your logs inside that function, so you find what is causing this problem. If you need some additional info about variables values, etc. when the problem occurs, just add additional logs with it. If your problem is easy to reproduce, you will quickly find the reason. Just remember, that sometimes adding new logs will make the problem dissapear (compiler will organize assembly in a different way), but that's something you just have to take into consideration.

Regards
Pomnico

'Ussyless' said:

OK, since i'm desperate, I've attached my source files, if anyone could tell me whats wrong, i'd be grateful (you may have to change some of the includes to your directories)
kinda new to c++ but i have experience in other languages, just gotta get used to this one, so i know some of my scripts might be a bit inefficient but thats not a problem for now.
thanks
will remove these files if/when this is solved


What I have found after few moments:
- debug::pop - you declare line[20] but inside this method you try to set line[20] = line[19] (for i = 20)
- debug::draw -You are not calling delete on "a" varable. Why not passing to draw_string function "s.c_str()" directly?

Sorry, but I can't launch it atthe moment, so I would just give you short advice on how to look for such problems (in case of simple programs, like yours). Use printf to log current position in your program:
printf("LOG: %s(%d) : %s\n", __FILE__, __LINE__, __FUNCTION__);
Put it at the beginning of main and at end of main for start, as well as in the same way inside all callback functions registered to glut - display, keyboard, reshape, etc.
Run your program and look at end of log. If you see that program has entered inside some function, but has not returned from it when it has crashed, just tighten your logs inside that function, so you find what is causing this problem. If you need some additional info about variables values, etc. when the problem occurs, just add additional logs with it. If your problem is easy to reproduce, you will quickly find the reason. Just remember, that sometimes adding new logs will make the problem dissapear (compiler will organize assembly in a different way), but that's something you just have to take into consideration.

Regards
Pomnico

well funny thing about the debug::draw script was, i wrote it one day, and the next day i forgot what it did, so i thought it would be best not to mess with it lol
thanks for reply, ill see if i can find the issue

This topic is closed to new replies.

Advertisement