Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 883
Oleg Glazov Avatar asked Jul 04 '26 11:07

Oleg Glazov


1 Answers

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...

like image 127
Alexander Jung Avatar answered Jul 07 '26 03:07

Alexander Jung



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!