Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Setting environment variable when debugging via "Start and debug external application"

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

Scheduled Pinned Locked Moved Qt Creator and other tools
3 Posts 3 Posters 2.5k Views
  • 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 Offline
    M Offline
    Moschops
    wrote on 5 Sept 2014, 08:51 last edited by
    #1

    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
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 5 Sept 2014, 22:10 last edited by
      #2

      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
      0
      • A Offline
        A Offline
        andreyc
        wrote on 6 Sept 2014, 06:30 last edited by
        #3

        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
        0

        2/3

        5 Sept 2014, 22:10

        • Login

        • Login or register to search.
        2 out of 3
        • First post
          2/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved