Debug and Release

Started by
16 comments, last by szecs 12 years, 9 months ago
Yes, of course. Check for uninitialized variables in your code first (this includes unallocated memory). Another cause could be that the application cannot find resources like images, text files etc... supposing you use them in your application.
Advertisement
It's good practice to instantiate your variables as soon as you declare them.
To an extent, you can have the compiler aid you with detecting the use of uninitialized variables.

Enable warnings-as-errors (/WX) and ensure you have at least warning 4700 enabled. Also add /RTCu.

Of course, this shouldn't be used as a crutch as IMHO, *every* variable should be initialized.
I havent had a chance to initialise every variable yet, I will report back when I have, I am posting however because I am using files (txt documents) but would that affect the release version seeing as nothing has been moved?
Yup, working with files with only the filename without the full path will result in this. Your release exe is searching for the files in the "current folder", which is the folder where the exe is. So, the 'release' folder, and I guess you don't have those txt files there. That's why I asked the question in my first post. Copy the files into the 'release' folder, and see how it goes.

I havent had a chance to initialise every variable yet, I will report back when I have, I am posting however because I am using files (txt documents) but would that affect the release version seeing as nothing has been moved?


But you check for failure conditions in the case where the files can't be opened... right? ....
We would need more info... Does the program crash or it just dosen't start?

[Quote=szecs]
Yup, working with files with only the filename without the full path will result in this. Your release exe is searching for the files in the "current folder", which is the folder where the exe is. So, the 'release' folder, and I guess you don't have those txt files there. That's why I asked the question in my first post. Copy the files into the 'release' folder, and see how it goes.
[/Quote]

Copying stuff in the debug or release directory is a very bad idea btw. Never do that. Visual studio lauch the application from the application folder, not the debug/release build, thats where files should be copied. If you want to test your program without the ide, then copy the .exe in this directory instead, delete it afterward, way better this way imo.

We would need more info... Does the program crash or it just dosen't start?

[Quote=szecs]
Yup, working with files with only the filename without the full path will result in this. Your release exe is searching for the files in the "current folder", which is the folder where the exe is. So, the 'release' folder, and I guess you don't have those txt files there. That's why I asked the question in my first post. Copy the files into the 'release' folder, and see how it goes.


Copying stuff in the debug or release directory is a very bad idea btw. Never do that. Visual studio lauch the application from the application folder, not the debug/release build, thats where files should be copied. If you want to test your program without the ide, then copy the .exe in this directory instead, delete it afterward, way better this way imo.
[/quote]

May be very bad, but at least we 'd know where the bug is.

A good idea is to work with proper folders, full pathnames or whatever.

This topic is closed to new replies.

Advertisement