1

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?

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

4 Comments

When I click on a kit (such as Desktop (default)), it lists a number of properties; however, none of them are Environment. The list is: Name, Device type, Device, Sysroot, Compiler, Debugger, Qt version, and Qt mkspec.
I just noticed that I have 3.4.2, not 3.1.1 installed. That must be the difference :(
Ok - I think I will just upgrade, perhaps it's not possible in 3.1.1!
Yes, that should help. See screenshot in official documentation: doc.qt.io/qtcreator/creator-targets.html

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.