标头导入并包含 XCode、cmath、objc-class.h 等中的失败
我一直在包含 cmath 等基本标头时遇到问题。它在使用示例项目时最为普遍。 示例:
#include <cmath>
例如,即使我可以验证我正在使用的 SDK 是否有该文件,但仍找不到该文件:
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/usr/include/c++/4.2.1/tr1/cmath
有时我可以通过直接导入到该文件来解决该问题,但这并不总是有效。
#include </usr/include/c++/4.2.1/cmath>
I keep having issues with including basic headers such as cmath. It is most prevalent when using example projects.
Example:
#include <cmath>
for instance gets a file not found, even though I can verify that the SDK I'm using has it:
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/usr/include/c++/4.2.1/tr1/cmath
I can sometimes work around the issue by importing directly to the file, but this doesn't always work.
#include </usr/include/c++/4.2.1/cmath>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的源代码文件的扩展名是什么? .m还是.mm?如果它是 .m,编译器将假定您有一个常规的 Objective-C 文件,而 .mm 则意味着一个 Objective-C++ 文件。如果它不是 .mm 文件,编译器可能不会查找 C++ 包含文件。
What is the extension of your sourcecode file? .m or .mm? If it's .m, the compiler will assume you have a regular objective-C file, whereas .mm would imply an objective-C++ file. If its not a .mm file, the compiler may not be looking for C++ includes.