Setting environment variable when debugging via "Start and debug external application"



  • I have a (set of inter-related) projects that I develop and debug through QT Creator, but do not build using QT Creator. Everything was great until the code changed and now there needs to be an environment variable set when the executable begins.

    I can set environment variables in "Project -> Run Settings", but it seems that when I start the process through "Start and debug external application" those environment variables aren't used. My standard terminal takes its env vales from my ~/.bashrc, which contains the necesary environment variable, but it seems that starting via "Start and debug external application" runs the executable in an environment that does NOT contain the needed environment variable, even when I tick the box for "Run in terminal".

    Is there a way to specify the environment variables when starting a process through "Start and debug external application"?


  • Lifetime Qt Champion

    Hi,

    Interesting question, you should also try asking in on the qt-creator mailing list. You'll find there Qt Creator's developers/maintainers



  • One of the option maybe to start an app through a shell script
    @
    #!/bin/sh

    export MYTEST="Hello, world!"
    exec /path/to/your/app
    @

    Select this script in "Local Executable" files and run it.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.