English 中文(简体)
页: 1
原标题:#include <string> file not found in iOS in C++ file
  • 时间:2012-05-01 22:15:35
  •  标签:
  • c++
  • ios
  • xcode

我在OS下有一个客观的C/c++项目,从OS/X转而去,我收到一个没有发现错误的文件。

#include <string>

它是一个清洁的项目,我刚刚从旧项目中添加了档案。 STL是否包括在XCode设立? 发现一些可能性,例如:

/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/usr/include/c++/4.2.1/debug/

but adding this to the search path just threw up more errors. Any suggestions? (apart from don t use string - it s in house code I m porting)

xcode 4.2.1, ios5.0在OS/X 10.7.3上运行,在文件编中,代码对OS/X进行罚款。

最佳回答

您是否真正相信<条码>和设计;是否只是从文件上包含?

我刚刚在一个新项目中进行了测试,增加了一个文件,包括<代码><string>,并且如预期(Xcode版本,同SDK版本)。

但是,如果我把<代码>和t;string>列入卷宗,那么,当然,我拿到“没有发现”汇编错误的“档案”。

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

Do you include <string> 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.

还检查了您的有预谋的头盔,看看你是否把一些C++带上了。

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

问题回答

如果你在奥杰克档案中包含一名头盔,包括<代码><string>,那么你就照此办理。 所有的XCode文件都使用C汇编器(clang或llvm-gcc)。 页: 1 (clang++或 llvm-g++)

我建议通过你的所有文件并将其重新命名为mm。 包括主食。

对我来说,原因是

MyHeader.h(包括 #)目标公开。 将其改为项目并汇编。

For cocoa pod: s.public_header_files = MyProject/Classes/**/*.h

s. 项目_header_files = My Project/Classes/MyHeader.h





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签