编辑环境设置
您可以全局或针对特定项目或工具包更改构建或运行环境的环境变量值:
- 要更改全局值,请转至首选项>Environment >System ,然后在Environment 中选择Change 。
- 要更改项目的值,请在项目、构建或运行环境设置中选择Edit 或Add 。
- 要更改工具包的值,请转至首选项>Kits >Kits ,然后在Environment 中选择Edit Build Environment 或Edit Run Environment 。
使用以下语法输入环境变量名称和值:<VARIABLE>=<VALUE>
。要临时禁用变量,请在行首添加一个哈希字符 (#)。
注意: 在不同语句(追加、预追加、取消设置)中使用这种方法可能会导致环境发生意想不到的变化。
要从环境中删除变量值,请输入变量名。例如,TEST
会在构建或运行项目时将TEST
变量的值设置为空。
要在环境中添加变量值,请输入变量名和变量值,中间用等号隔开。例如,下面一行将/opt/bin
文件夹预置到现有 PATH 中:
- 在 Windows 上
PATH=C:\opt\bin;${PATH}
- 在 Linux 下: 在 Linux 下: 在 Linux 下: 在 Linux 下
PATH=/opt/bin:${PATH}
要添加或删除多个变量,请将它们分别放在不同的行中。顺序很重要。如果在某一行中删除了一个值,就不能在后面的行中引用它。不过,可以在前一行引用某个值后再将其删除。
要添加注释或禁用上述任何操作,请在注释前加上两个散列字符 (##)。
另请参阅 为项目指定环境、为构建配置项目、为运行配置项目、使用Qt Creator 变量和工具包。
Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.