Error C1047: Object file created with an older compiler than other objects

前端 未结 11 815
遇见更好的自我
遇见更好的自我 2020-12-17 08:03

I have a project that I\'m building in C++ in Release mode in Visual Studio 2008 SP1 on Windows 7 and when I build it I keep getting:

fatal error C104

相关标签:
11条回答
  • 2020-12-17 08:44

    It could also be that the offending library was built with a different "Platform Toolset" setting (in Project Properties->General).

    0 讨论(0)
  • 2020-12-17 08:44

    With reference to MSDN, this error The object or library file 'file' was created with an older compiler than other objects; rebuild old objects and libraries is caused when object files or libraries built with /LTCG are linked together, but where those object files or libraries are built with different versions of the Visual C++ toolset.
    This can happen if you begin using a new version of the compiler but do not do a clean rebuild of existing object files or libraries.
    To resolve, rebuild all object files or libraries.

    0 讨论(0)
  • 2020-12-17 08:50

    I had this problem but my solution differs:

    For me the culprit was that an included external library was compiled with

    /GL (=Enable link-time code generation under
          C/C++/ Optimization / Whole Program Optimization) 
    

    using an older visual studio (2005). I rebuild said library in 2005 without /GL and the linker error disappeared in 2008. As MSDN states it has to do with the /LTCG setting, this is set automatically by the /GL flag: http://msdn.microsoft.com/en-us/library/ms173554%28v=vs.80%29.aspx

    0 讨论(0)
  • 2020-12-17 08:52

    Two ways:

    1.Update to Sp1 to build the lib

    2.Please check your build to make sure that Whole Program Optimization is disabled. For a static lib project, go to the property page and change “Configuration Properties->C/C++->Optimization->Whole Program Optimization” to “No”.

    0 讨论(0)
  • 2020-12-17 08:53

    I try everything here... and my mistach become of a bad reference and duplicate GUID (between 2010 and 2015 project... the hell of copy/past project)

    During project migration from VS2008 to 2010 and 2015. We keep all project version XXX.vxproj (for VS2010) and XXX_2015.vxproj (for VS2015).

    And in one of them in 2015 solution we got a reference to 2010 project !

    So check REFERENCE... and never duplicate GUID.

    0 讨论(0)
提交回复
热议问题