Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

#include<vector> no such file or directory

So I need to use vectors in my project. I have changed the .m file to .mm to make it Objective-C++. But, when I try saying:

#include <vector>

In my .h it says the file or directory can not be found. If I put that line of code though in my .mm file though the error doesn't appear, but since I need a vector in the @interface (which is in my .h) what should I do to make the .h file find the vector file?

Also, I have tried changing it to compiling everything as Objective-C++, but that doesn't work because I get some errors in the Cocos2d library I am using...

like image 374
Dair Avatar asked Jun 26 '11 20:06

Dair


2 Answers

Is your .h file being included in any OTHER .h or .m files?

If so, you'll have to make those (or files including them, etc) into .mm as well.

like image 163
mackworth Avatar answered Nov 13 '22 22:11

mackworth


Without changing any .m to .mm or anything like that, if you click your project, click tagets->build settings go all the way down to "LLVM GCC 4.2 - Languages" you will see Compile Sources As change that value to Objective-C++;

like image 21
John Riselvato Avatar answered Nov 13 '22 23:11

John Riselvato