开发者

Trying to use C++ in an iPhone app

I am trying to u开发者_运维百科se c++ in an iphone app. I added the line

#include <cstring>

in one of my files.

I get "error: cstring: no such file or directory". What do I need to do to get it working?

My understanding is that gcc is being called, but not g++. How can I change that, or what flag can I add to force gcc to compile c++?


Objective-C++ files must have the .mm extension by default in an iPhone app... otherwise it's probably a crazy path setting. Anything weird in the build settings?


As @robert said, the easiest way is to name your file .mm instead of .cpp. Or you can pass the compiler flag

-x objective-c++
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜