'C++ - Code compiles in Debug but not in Release
I have some code that compiled without an error in debug mode but when I tried to compile in release code, this is what I have:
2>someSolution.lib(someClass.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance 2>fatal error C1047: The object or library file '..\release\someSolution.lib' was created with an older compiler than other objects; rebuild old objects and libraries
I have tried to use Clean Solution and Rebuild solution without any luck. I have even tried to delete the .lib file in Windows to force it to be rebuilt.
Any help? Thanks!
Solution 1:[1]
Turns out I will need to get the Visual Studio 2008 SP1 installed. Thanks for everyone else who helped in this question.
Solution 2:[2]
I'm assuming this is Visual Studio? This error looks like you are mixing different toolset versions within the projects of your solution. It probably doesn't happen in debug mode because that doesn't use the /LTCG (Link-time Code Generation) option.
Solution 3:[3]
Assuming you are using Microsoft Visual Studio, please verify that the options set in Project > right click > Preferences > Linker (especially check the dynamic libraries paths and dependencies) are the same in release mode with those in debug and that you have not forgotten to include anything.
Solution 4:[4]
In the Visual Studio Proj Configuration, you have to pay attention that the debug config and release have the right linked library AND additional headers directories.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | AZhu |
| Solution 2 | Maurice Gilden |
| Solution 3 | Nick Louloudakis |
| Solution 4 | Giuseppe Randazzo |
