Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

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

    Tools
    3
    3
    1951
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      Moschops last edited by

      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"?

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

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

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 0
        • A
          andreyc last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post