Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
770 views
in Technique[技术] by (71.8m points)

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

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 C1047: The object or library file '.Releasefoobar.obj' was created with an older compiler than other objects; rebuild old objects and libraries.

The error occurs while linking.

I've tried deleting the specific object file and rebuilding but that doesn't fix it. I've also tried blowing away the whole release build folder and rebuilding but that also didn't fix it. Any ideas?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...