I have a simple OpenGL project in Xcode.
Xcode started to behave in a strange way after upgrading to 4.5
In the following line
#include <fstream.h>
Compilation fails with the following error meesage: Lexical or Preprocessor Issue ‘fstream.h’ file not found.
The same code used to compile sucessfully in Xcode 4.2
changing the line to
#include <c++/4.2.1/backward/fstream.h>
fixes the problem but generates several other compilation errors.
fstream.h is not a C++ header. When you use the longer path name you’re accessing a different, incompatible standard library implementation (named libstdc++) that had a compatibility header named fstream.h (for compatibility with pre-standard C++; C++ was standardized over 14 years ago).
fstream.h worked with Xcode 4.2 because that version of Xcode used libstdc++ by default, but Xcode 4.5 has moved to use libc++ by default instead.
The solution is to use standard C++ and include
<fstream>.Alternatively, and I wouldn’t recommend this, you could switch the standard library implementation you’re using in your project settings.