C++ 向 MinGW 添加额外的包含/lib 路径
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4537377/
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
Add extra include/lib paths to MinGW
提问by delaccount992
I would like to add some extra include/lib directories besides the default ones for MinGW to search upon compilation. The reason for this is because the hard drive I currently have MinGW installed into is nearly full and so I had to install Qt into my second one instead. Thus, how can I have MinGW include the Qt files by default?
除了 MinGW 在编译时搜索的默认目录之外,我想添加一些额外的 include/lib 目录。原因是因为我目前安装 MinGW 的硬盘快满了,所以我不得不将 Qt 安装到我的第二个中。因此,如何让 MinGW 默认包含 Qt 文件?
回答by Piotr Dobrogost
You can set environment variables CPLUS_INCLUDE_PATH
for include directories and LIBRARY_PATH
for library directories. More information can be found in Environment Variables Affecting GCC
您可以CPLUS_INCLUDE_PATH
为包含目录和LIBRARY_PATH
库目录设置环境变量。更多信息可以在影响 GCC 的环境变量中找到
回答by ismail
Use -I
directive for extra includes and -L
directive for extra library paths such as:
将-I
指令用于额外的包含和-L
指令用于额外的库路径,例如:
g++ [...] -I C:\qt\include -L C:\qt\lib
You can use multiple -I
and -L
options.
您可以使用多个-I
和-L
选项。