gcc:如何忽略标准包含路径?

时间:2010-06-07 10:43:11

标签: gcc

我需要使用标准库头的修改版本来编译一些文件。使用Visual C ++编译器,我将通过使用 / X(忽略标准包含路径) / I(其他包含目录)参数来完成此操作。如何用gcc完成这个?

2 个答案:

答案 0 :(得分:49)

gcc -nostdinc -I/custom/include/path/goes/here

-nostdinc忽略标准C包含目录 -nostdinc++忽略标准C ++包含目录

答案 1 :(得分:8)

如果您只是在命令行中添加-I,您会看到(特别是如果您还添加-v)gcc将在查找任何其他文件夹之前先查看这些文件夹。因此,您无需添加--nostdinc)以使用备用STL库。

这样就使用了STLPort:

g++ -I path-to-stlport-include main.cpp -L path-to-stlport-lib -lstlport

相关问题