Reputation: 3509
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
Upvotes: 5
Views: 10690
Reputation: 1252
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.
Upvotes: 15
Reputation: 244981
Any idea whats happening?
Yes:
The object or library file '../IncludeLibs/libfftw-3.3-x86.lib' was created with an older compiler than other objects
What I can do to resolve this?
You can:
rebuild old objects and libraries
Looks like the debug build is linking to different versions of the libraries than the release build. The easiest thing to do would be to download the source code for the library that you're using and build it with the same build system that you're using to build your project.
It rarely works out well to download binary files and try to link them in. You'll run into all sorts of problems if they weren't compiled with the same settings and on a compatible compiler/linker as the one you're trying to use.
Upvotes: -3