Reputation: 24121
I am running Qt Creator 3.1.1 on Ubuntu 14.04, and building a program which links to a library located in /usr/local/lib
. Now in my .bashrc
file, I have set the LD_LIBRARY_PATH
variable to include this directory, and then if I run my program from bash, it runs ok. However, if I try to run it from within Qt Creator (by pressing the green arrow), then I receive an error message that it cannot find the library.
So, my temporary solution is to go into Build->Run Environment
and set the environment variable LD_LIBRARY_PATH
in there. However, I would need to do this on every new project, and since /usr/local/lib
is a common directory for locally-installed libraries, this could become frustrating.
Is there any way in Qt Creator to set environment variables for all projects by default, rather than having to set it manually for each individual project?
Upvotes: 1
Views: 12053
Reputation: 1304
You can set environment variables per Kit. Open Preferences, go to Build & Run, select the Kits tab. Select the kit for which you would like to set the variable. In the properties list there is an item called Environment. Click on the Change button and enter your variables.
Upvotes: 2