Well I tried to compile a small testing app I am working on.
So to keep things short and simple:
When I set my code generation from "Multi Threaded DLL" to "Multi Threaded" to get rid of some dependencies, the following line of code crashes my application (where it usually runs without any flaws)
The crash happens when I want to convert a short path to a long path. as such:
LPCSTR tmp = reinterpret_cast<LPCSTR>(getenv("Temp"));
GetLongPathNameA(tmp,tempFolder,MAX_PATH);
The crash specifically occurs at the first line:
LPCSTR tmp = reinterpret_cast<LPCSTR>(getenv("Temp"));
So any ideas here why it suddenly stops working when you switch the code generation mode? Thanks!
EDIT:
After some code-rewriting I managed to find out it specifically crashes when executing
getenv("Temp");
very very weird seeing as it does work in the other mode
Be sure that all projects, (and all files of those projects) are consistently set to compile and link against the same version of the runtime libraries, i.e. multithreaded static, in your case. If you mix these options the compiles and linked program will have undefined behavior. Also assure that you compile and link against the correct versions of the external libraries (MFC, etc..). In some cases you are restricted to use certain versions of runtime, e.g. if you interoperate with .Net, you have to use the multitheaded dll version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With