我在同一台 CentOS
计算机上使用 2 个不同的 GCC
版本(包括操作系统一和自定义操作系统),并且我不想更换系统 GCC
与我的自定义 GCC,我仅使用自定义 GCC 来构建一些软件。
问题是 Qt Creator
添加 /usr/include
自动包含文件夹,因此自定义 GCC
开始使用系统 C++ 包含并因奇怪而崩溃诸如 error: '::memchr' 尚未声明的错误消息
。我的 *.pro
文件中没有 /usr/include
,所以看起来 Qt Creator
自己添加了它们。
如何禁止 Qt Creator 项目使用某些特定的包含补丁以允许在具有 2 个 GCC 版本的计算机上进行编译?当我在同一台机器上使用 Eclipse CDT 时,它工作得非常好,因为 Eclipse 本身不添加任何内容,只使用我指定的包含目录。
最佳答案
您可以使用CXXFLAGS += -nostdinc
。
这应该执行以下操作(摘自手册):
Do not search the standard system directories for header files. Only the directories you have specified with -I options (and the directory of the current file, if appropriate) are searched.
关于c++ - 如何禁止Qt Creator自动使用特定的包含路径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27821640/