Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fatal error C1047 in release build only

My project uses Visual Studio 2012, and I am using the libfftw-3.3.lib as coming from their page. When I build my project in debug, it links and compiles just fine, and I get a working application. When I set it to release mode, the linker gives me following error:

2>LINK : fatal error C1047: The object or library file '../IncludeLibs/libfftw-3.3-x86.lib' was created with an older compiler than other objects; rebuild old objects and libraries
2>LINK : fatal error LNK1257: code generation failed

When I set my project to output a .lib, even in release mode, it works, but not as .dll or .exe

Any idea whats happening, or what I can do to resolve this?

Edit: my linker settings, debug:

/OUT:"G:\GlukoseScanner\GlucoseScanner\Debug\MachineLearning.exe" /MANIFEST /NXCOMPAT /PDB:"G:\GlukoseScanner\GlucoseScanner\Debug\MachineLearning.pdb" /DYNAMICBASE "../debug/GlucoseDLL.lib" "shlwapi.lib" "../PicoScope/ps5000a.lib" "../C/cbw32.lib" "../DSO2250_SDK/Lib/SDK2250DLL.lib" "../IncludeLibs/libfftw-3.3-x86.lib" "../IncludeLibs/libfftwf-3.3-x86.lib" "mlpack.lib" "winmm.lib" "opengl32.lib" "glu32.lib" "..\..\armadillo-4.400.1\build\Release\armadillo.lib" "..\..\armadillo-4.400.1\examples\lib_win32\libblas.lib" "..\..\armadillo-4.400.1\examples\lib_win32\liblapack.lib" "..\libxml2\libxml2-2.7.8.win32\lib\libxml2.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /DEBUG /MACHINE:X86 /INCREMENTAL /PGD:"G:\GlukoseScanner\GlucoseScanner\Debug\MachineLearning.pgd" /SUBSYSTEM:CONSOLE /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"Debug\MachineLearning.exe.intermediate.manifest" /ERRORREPORT:PROMPT /NOLOGO /TLBID:1 

The Linkersettings for release:

/OUT:"G:\GlukoseScanner\GlucoseScanner\Release\MachineLearning.exe" /MANIFEST /LTCG /NXCOMPAT /PDB:"G:\GlukoseScanner\GlucoseScanner\Release\MachineLearning.pdb" /DYNAMICBASE "../release/GlucoseDLL.lib" "shlwapi.lib" "../PicoScope/ps5000a.lib" "../C/cbw32.lib" "../DSO2250_SDK/Lib/SDK2250DLL.lib" "../IncludeLibs/libfftw-3.3-x86.lib" "../IncludeLibs/libfftwf-3.3-x86.lib" "mlpack.lib" "winmm.lib" "opengl32.lib" "glu32.lib" "..\..\armadillo-4.400.1\build\Release\armadillo.lib" "..\..\armadillo-4.400.1\examples\lib_win32\libblas.lib" "..\..\armadillo-4.400.1\examples\lib_win32\liblapack.lib" "..\libxml2\libxml2-2.7.8.win32\lib\libxml2.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /DEBUG /MACHINE:X86 /OPT:REF /SAFESEH /INCREMENTAL:NO /PGD:"G:\GlukoseScanner\GlucoseScanner\Release\MachineLearning.pgd" /SUBSYSTEM:CONSOLE /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"Release\MachineLearning.exe.intermediate.manifest" /OPT:ICF /ERRORREPORT:PROMPT /NOLOGO /TLBID:1 
like image 822
SinisterMJ Avatar asked Aug 22 '14 14:08

SinisterMJ


1 Answers

Right click your project under release configuration Configuration Properties -> General -> Whole Program Optimization -> "No Whole Program Optimization"

Your linked library may be don't enable LTCG optimization, and VS2012 can't optimize your program with /LTCG.

like image 75
ravin.wang Avatar answered Oct 01 '22 22:10

ravin.wang