문제

I'm trying to use std::vector in a iOS6.0 application developped in Xcode 4.5 compiled with LLVM GCC 4.2 and I renamed with the .mm extension the files I'm using C++ in. But for some reason, the headers associated with those .mm don't get compiled I've got the following error :

Vector: No such file or directory

I've tried import, include. It works if I only include it in the .mm though.

Any idea what I'm doing wrong ?

Thank you

Webaba

RESOLVED : carefully check for other .m files potentially including this header. (not only the one implementing the class) I missed one.

도움이 되었습니까?

해결책

Make sure that ever file including the headers is compiled as an Objective-C++ or a C++ file. You can do this by going selecting a source file, and in the File Inspector of the Utilities panel, you can set how Xcode should compile your file.

The same would happen if you were trying to compile a C source file which included Objective-C headers, for example.

Edit: if the command used to compile contains anything like -nostdinc or -nostdinc++, then you might have to change your project settings. There should be a setting in the section LLVM GCC 4.2 - Language which is labelled Use Standard System Header Directory (for me this is the last setting of that section). Make sure it is set to yes.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top