Sign in to follow this  
Ussyless

Compiling release version in microsoft visual c++ 2010

Recommended Posts

Ussyless    142
Hi, so im trying to compile my project so that it can run on other computers, on the net is says all i have to do is change to release mode and set it to multi-threaded in compile options
when i do this i cant run the exe(without error) even on my own computer, i can run it when i use multi-threaded dll, but i cant run it on any other computers

My friend is getting an error saying " the program cant start because MSVCP100D.dll is missing from your computer"


any help is appreciated, if you need more info, just ask

Share this post


Link to post
Share on other sites
Monkan    1087
It should work,

Make sure its set to release mode then go to Project -> Properties -> Configuration Properties -> C++ -> Code Generation

and change the runtime library to Multi-threaded (/MT)

If you are in debug mode you should change it to Multi-threaded Debug (/MTd)

Works fine for me and that is the error associated with it.

Share this post


Link to post
Share on other sites
SiS-Shadowman    359
It's correct that you set the project to release mode, since the debug runtimes are only installed with visual studio, which your consumer most likely won't have. You (and any user) must install the [url="http://www.microsoft.com/downloads/en/details.aspx?familyid=A7B7A05E-6DE6-4D3A-A423-37BF0912DB84&displaylang=en"]Visual C++ 2010 Redistributable[/url]. This installs the release runtime (which should contain that missing dll, for example).

Share this post


Link to post
Share on other sites
Ussyless    142
error associated with multi threaded compile is
First-chance exception at 0x00401a02 in SpaceSpeedster.exe: 0xC0000005: Access violation reading location 0x39960273.
Unhandled exception at 0x00401a02 in SpaceSpeedster.exe: 0xC0000005: Access violation reading location 0x39960273.

just tested running a release compile with the same compile settings with a different project, and it worked for that one

Share this post


Link to post
Share on other sites
Monkan    1087
[size="2"][color="#1C2837"]If you set the option in release mode as I have said then you don't need to install anything to make it run.....................[/color][/size]
[size="2"][color="#1C2837"]
[/color][/size]
[size="2"][color="#1C2837"]Just make sure you get the .exe out of the Release folder.[/color][/size]

Share this post


Link to post
Share on other sites
SiS-Shadowman    359
[quote name='Monkan' timestamp='1295962029' post='4764429']
[size="2"][color="#1C2837"]If you set the option in release mode as I have said then you don't need to install anything to make it run.....................[/color][/size]
[/quote]

Your program will [u][b]not[/b][/u] run without the redistributable, not even if you wish for it. Chances are another program installed it, but that is not always the case.
However the error mentioned by the OP seems to indicate that he delivered a debug executable, instead of a release one (which is indicated by the d in the dll name: MSVCP100[b]D[/b].dll).

*edit*
It will only work if you link against the static runtime (in which case the runtime is included in your executable), however that has some drawbacks that might be confusing for newcomers.

Share this post


Link to post
Share on other sites
Ussyless    142
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"

Share this post


Link to post
Share on other sites
Aardvajk    13207
If the exe runs on your computer in debug but not in release (if I understand the above) then the chances are that there is a bug in your code that the debug build is supressing somehow. It's quite possible to have an error that does not produce a crash in debug but does in release.

I'll confirm again, just for the record, if you set Runtime Library to /MT then you do not need any of the redistributable on the target computer.

If you run your program in release mode from within the IDE, does it give you any more useful information about the cause of the crash? That's where I'd start, not buggering about with dependency issues - if it won't run on your PC, where we know we have the libraries as VS is installed, that isn't the problem.

Share this post


Link to post
Share on other sites
SiS-Shadowman    359
[quote name='Aardvajk' timestamp='1295967521' post='4764461']
I'll confirm again, just for the record, if you set Runtime Library to /MT then you do not need any of the redistributable on the target computer.
[/quote]

I'm sorry, I oversaw the /MT in the original comment, hence my reply: You only need the redistributable with the /MD switch.

Share this post


Link to post
Share on other sites
Burnt_Fyr    1665
[quote name='Ussyless' timestamp='1295961788' post='4764427']
error associated with multi threaded compile is
First-chance exception at 0x00401a02 in SpaceSpeedster.exe: 0xC0000005: Access violation reading location 0x39960273.
Unhandled exception at 0x00401a02 in SpaceSpeedster.exe: 0xC0000005: Access violation reading location 0x39960273.

just tested running a release compile with the same compile settings with a different project, and it worked for that one
[/quote]

99 times out of 100, if you see that error, it's an unitialized pointer. Step through the program(release build) line by line until you find the call using the pointer, and once you've found it, make sure it is initialized to null before use.

Share this post


Link to post
Share on other sites
AndyEsser    394
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.

Share this post


Link to post
Share on other sites
yewbie    677
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.

Share this post


Link to post
Share on other sites
Ussyless    142
here is complete output when compiling

[code]'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.

[/code]

also yewbie, if you read that much you should have also seen
[quote]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"[/quote]

the linkers are the same for the debug & release also

dont think i've left anything undefined


what a paint this is >.>

Share this post


Link to post
Share on other sites
Ussyless    142
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

Share this post


Link to post
Share on other sites
Pomnico    110
[quote name='Ussyless' timestamp='1296194290' post='4766041']
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
[/quote]

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:
[code]printf("LOG: %s(%d) : %s\n", __FILE__, __LINE__, __FUNCTION__);[/code]
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

Share this post


Link to post
Share on other sites
Ussyless    142
[quote name='Pomnico' timestamp='1296202890' post='4766073']
[quote name='Ussyless' timestamp='1296194290' post='4766041']
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
[/quote]

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:
[code]printf("LOG: %s(%d) : %s\n", __FILE__, __LINE__, __FUNCTION__);[/code]
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
[/quote]
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this