I am dealing with a very peculiar problem at the moment: I have an application that is fully working in Debug-Buildmode, whether I run it from the MSVC environment or start the built executable myself. If I build this application in Release-Buildmode, it is fully working when I run it from the MSVC environment, but shows unexpected behavior when I start it myself.
What differences between the Debug and Release mode could be the reason for this behavior, and why do the problems only occur when I start the executable manually?
It's hard to give code, since it is quite a big project and I have absolutely no clue what could be causing the problem. The program flow is basically:
- Read settings from file (not the problem, double checked the read values, and used an ini- and the libconfig++-library to be sure)
- Distribute values to seperate classes (double checked the passed values)
- One of these classes starts a thread (
boost::thread
) and triggers callback functions on certain events (these do NOT trigger if release build is executed manually)
Something that I could imagine might cause problems, but I am not sure of:
- Since the classes were written by different people, there is inconsistency between the usage of
std::string
andstd::wstring
. I am converting from one to another usingstd::wstring(s.begin(), s.end())
and vice versa.
Could this be the reason for my problems, and if yes, how do I solve the issue? I would really appreciate some help on this. Thanks in advance.
Update:
- The program does not crash and variables do not seem to have different values when I use the infamous print-debug method (since in the debugger everything works out fine)
- I have read that unitialized variables could be causing this issue and triplechecked every variable used by me, and every variable is initialized properly
- In unit tests, every module I am using works as expected (though I'm not sure I got the border cases right everytime, since I have not written all modules myself).
Update 2:
- While disabling optimization step by step and bringing the release buildmode closer to the debug buildmode I was able to narrow the problem down: **In the code generation tab, my program works with the
Multithreaded-Debug-DLL
, not theMultithreaded-DLL
, regardless to optimization settings.
This seems to be a nice accomplishment, yet I lack the understanding for this problem.