博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Windows: Environment Variables for MinGW
阅读量:4039 次
发布时间:2019-05-24

本文共 2792 字,大约阅读时间需要 9 分钟。

Environment variables, as the name implies, are variables that hold directories paths as strings. Environment variables goal is to keep track of important files for the system.

In windows, the most important environment variable is the PATH variable. You can check its content on the command line using the following command:
echo %PATH%
Environment variables can also keep track of important files for the compiler (e.g. MinGW GCC) like header files and static and dynamic library files.

Adding, editing or deleting environment variables

To add, modify or delete an environment variable, you'll need to head to Control Panel > System > Advanced System Settings. On the Advanced tab, click on the Environment Variables... button.
The following window will pop out.
List of environment variables
Environment variables are divided in two groups: User variables and System variables. The most important group is the System group. You can create, modify or delete variables using the button New, Edit or Delete respectively.
Let's try editing the Path variable. Click on the Path variable in the System variables group and then click the Edit button.
As you can see, the variable is a list of directory paths separated by the ";" character. The most safe way of adding a new directory is by appending the path as follows:
;C:\mingw\bin
That way there won't be name crashes.
There are many environment variables, let's review the most important ones.

Binary path (PATH)

The PATH (or Path, Windows is case insensitive) variable holds paths to binary files like . files, to   and to .  files.
Be careful with this variable, do not delete the default path like System32 and so on. Generally, you'll only need to append new directory paths to this variable.
For example:
Append ";C:\mingw\bin" to the Path variable
Important note: Do NOT create a new Path or PATH (again, Windows is case insensitive) variable in the system variable group or you'll override the default paths and you'll be in trouble.

Include paths (CPLUS_INCLUDE_PATH, C_INCLUDE_PATH)

These variable hold the directory paths to header files (like library header files). Important for linking new installed libraries.
Generally you'll need to append the path to a library "include" folder.
For example:
Append ";C:\mingw\include" to the CPLUS_INCLUDE_PATH
CPLUS_INCLUDE_PATH and C_INCLUDE_PATH are pretty much the same. When the compiler looks for a header file, it looks in both variables. So having two variables is only useful for the programmer to keep things tidy.

Library path (LIBRARY_PATH)

This variable hold the directory paths to   (.lib or .a files). This one is also important for linking new libraries.
Generally you'll need to append the path to a library "lib" folder.
For example:
Append ";C:\mingw\lib" to the LIBRARY_PATH

转载地址:http://irtdi.baihongyu.com/

你可能感兴趣的文章
01Java基础语法-13. if分支语句的灵活使用
查看>>
01Java基础语法-15.for循环结构
查看>>
01Java基础语法-16. while循环结构
查看>>
01Java基础语法-17. do..while循环结构
查看>>
01Java基础语法-18. 各种循环语句的区别和应用场景
查看>>
01Java基础语法-19. 循环跳转控制语句
查看>>
Django框架全面讲解 -- Form
查看>>
socket,accept函数解析
查看>>
今日互联网关注(写在清明节后):每天都有值得关注的大变化
查看>>
”舍得“大法:把自己的优点当缺点倒出去
查看>>
[今日关注]鼓吹“互联网泡沫,到底为了什么”
查看>>
[互联网学习]如何提高网站的GooglePR值
查看>>
[关注大学生]求职不可不知——怎样的大学生不受欢迎
查看>>
[关注大学生]读“贫困大学生的自白”
查看>>
[互联网关注]李开复教大学生回答如何学好编程
查看>>
[关注大学生]李开复给中国计算机系大学生的7点建议
查看>>
[关注大学生]大学毕业生择业:是当"鸡头"还是"凤尾"?
查看>>
[茶余饭后]10大毕业生必听得歌曲
查看>>
gdb调试命令的三种调试方式和简单命令介绍
查看>>
C++程序员的几种境界
查看>>