Question

I've created an Allegro 5 project in Xcode 4.6.3 as an empty project. I've added all the Allegro 5 libraries as described in the Allegro documentation. But now I need to use some C/C++ libraries and get the error, that Xcode doesn't find the libraries (e.g. 'fstream file not found').

#include <allegro5/allegro5.h>
#include <allegro5/allegro_native_dialog.h>
#include <allegro5/allegro_primitives.h>
#include <allegro5/allegro_image.h>
#include <fstream>
#include <string>
#include <vector>
#include <sstream>

How can I add the standard libraries to Xcode projects so that it finds them? Unfortunatelly I can't find any solution. This is not an Objective-C Project. It's written in C++ and also works if I don't use any of these libraries. Thanks!

Was it helpful?

Solution

Does the name of your source file end with an extension that indicates it's C++? If it ends in (for instance) .c or .m, the compiler will not consider it to be C++, therefore the C++ headers won't be found. Try changing the extension on the source file name to .cpp (or some other extension that implies C++, see C++ code file extension? .cc vs .cpp ) and see if the header is found.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top