C++ 如何在 GCC 搜索路径中包含头文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/973146/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to include header files in GCC search path?
提问by Mark
I have the following code in a sample file:
我在示例文件中有以下代码:
#include "SkCanvas.h"
#include "SkDevice.h"
#include "SkGLCanvas.h"
#include "SkGraphics.h"
#include "SkImageEncoder.h"
#include "SkPaint.h"
#include "SkPicture.h"
#include "SkStream.h"
#include "SkWindow.h"
However, this code is located in various folders within /home/me/development/skia (which includes core/ animator/ images/ ports/ svg/ and a lot more.)
但是,此代码位于 /home/me/development/skia 中的各个文件夹中(其中包括 core/animator/images/ports/svg/ 等等。)
How can I make GCC recognize this path?
如何让 GCC 识别这条路径?
回答by Tim Gilbert
回答by Reginaldo
The -I
directive does the job:
该-I
指令完成以下工作:
gcc -Icore -Ianimator -Iimages -Ianother_dir -Iyet_another_dir my_file.c