Oleg Glazov
Oleg Glazov

Reputation: 31

Environment variables in QtCreator debug

I'm developing an application under Debian 8 using QtCreator 3.4.0. The app uses some shared libraries, that I don't want to place in standard paths, like /usr/local/lib.

QtCreator adds paths to these to LD_LIBRARY_PATH environment variable. It works ok when running the app (ctrl+R) without debugger attached, but not when starting with debugger (F5). It also works if "run in terminal" checkbox is selected.

The question is: Is is possible to configure the creator to export LD_LIBRARY_PATH when debugging and not running in terminal and how to do it?

Upvotes: 3

Views: 5153

Answers (1)

Alexander Jung
Alexander Jung

Reputation: 31

Probably you solved the problem a long time ago but I've run into the same problem today and could solve it by opening the Tools/Options dialogue and there opening the section Debugger and the tab GDB.
In the field Additional Startup Commands I added the following:

set environment LD_LIBRARY_PATH /usr/local/lib/

Moreover I had to set the Run in terminal option in Project/Build&Run.
Now I was able so run the program in debug mode (of course I had to add -g in the build process).

Interestingly enough this command did not work when I tried to use gdb in a terminal...

Upvotes: 3

Related Questions