#include file not found in iOS in C++ file

后端 未结 2 584
生来不讨喜
生来不讨喜 2021-02-04 11:18

I have a objective c/c++ project under iOS, moving it from OS/X and I get a \'file not found\' error on

#include 

It\'s a clean p

2条回答
  •  旧巷少年郎
    2021-02-04 11:50

    Are you really sure is included only from a .cpp file?

    I just tested on a fresh project, by adding a .cpp file and including , and it works, just as expected (same Xcode version, same SDK version).

    But if I include in a .m file, then of course I got a «file not found» compiler error.

    So double-check this, as the error may come from here.

    Do you include from a .cpp file only, or from a .h file, intended to be used by a .cpp implementation?
    Then maybe it's also included by a .m file, hence the error.

    Also check your precompiled headers, if any, to see if you include some C++ stuff there...

    Also remember, in that later case, that you can rely on the __cplusplus macro, when needed.

提交回复
热议问题