标头导入并包含 XCode、cmath、objc-class.h 等中的失败

发布于 2024-10-07 06:16:54 字数 384 浏览 6 评论 0原文

我一直在包含 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我们只是彼此的过ke 2024-10-14 06:16:54

你的源代码文件的扩展名是什么? .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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文