简体   繁体   中英

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!

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.

假设您使用的是Microsoft Visual Studio,请验证在“项目”>“ 右键单击” >“首选项”>“链接器”中设置的选项(特别是检查动态库的路径和依赖项)在发布模式下与在调试模式下是否相同,并且您没有忘记包括任何东西。

Turns out I will need to get the Visual Studio 2008 SP1 installed. Thanks for everyone else who helped in this question.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM