xcode 包含路径冲突
在 MSVS 中,当我 #include
如果启用,两者都#include
访问样式和 #include “header.h”风格的指令将 搜索“用户标头”中的路径 “标题搜索”之前的“搜索路径” 路径”,结果是用户 标头(例如您自己的 String.h header) 优先于 使用 #include 时的系统标头 。这是使用以下方法完成的 -iquote 标志“用户标头搜索路径”中提供的路径。如果 禁用并且您的编译器完全禁用 支持单独的用户路径、用户 标头只能通过 包含“header.h”样式的预处理器指令。
出于向后兼容性的原因, 默认情况下启用此设置, 但禁用它是强烈的 受到推崇的。 [ALWAYS_SEARCH_USER_PATHS]
您知道如何解决这个问题吗?我真的不想更改头文件名称或从项目设置中删除搜索路径并使用本地文件的相对路径(../../ ... /SomeFolder/SomeHeader.h)。
In MSVS when I #include <someHeader> it is searched in a different folder than the headers included with #include "someheader". Same thing should be in xcode, but it seems that it does not work. Because of this I have conflicts with local headers that have same name as std headers(String.h, etc) and I can't include std headers. I tried to change project option "Always search user paths" but it still does not work. The help message from this options says that it will solve my problem, but...
If enabled, both #include
<header.h>-style and #include
"header.h"-style directives will
search the paths in "User Header
Search Paths" before "Header Search
Paths", with the consequence that user
headers (such as your own String.h
header) would have precedence over
system headers when using #include
<header.h>. This is done using the
-iquote flag for the paths provided in "User Header Search Paths". If
disabled and your compiler fully
supports separate user paths, user
headers will only be accessible withinclude "header.h"-style preprocessor directives.
For backwards compatibility reasons,
this setting is enabled by default,
but disabling it is strongly
recommended.
[ALWAYS_SEARCH_USER_PATHS]
Do you have any idea how to solve this? I really don't want to change my header files names or to remove search paths from project settings and use relative paths to local files (../../ ... /SomeFolder/SomeHeader.h).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通过将所有标头扩展名从 h 更改为 hpp 解决了问题...这不是真正的解决方案,但我保留了文件名,并且暂时解决了问题:)
I solved the problem by changing all headers extension from h to hpp... It's not a real solution, but I kept the file names and I solved the problem, for now:)