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. Qt Creator and environment variables on Windows

Qt Creator and environment variables on Windows

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
5 Posts 3 Posters 101 Views 2 Watching
  • 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.
  • R Offline
    R Offline
    Robert Hairgrove
    wrote last edited by
    #1

    This concerns runtime environment.

    Question: I know how to set environment variables in Qt Creator "Preferences". But does Qt Creator set any runtime environment variables of its own when an application is started in Qt Creator, as opposed to a deployed environment without Qt Creator?

    It would be nice if I could just query an existing variable instead of having to set it myself. That way, other developers would not have to remember to do this when they are maintaining my application.

    JonBJ 1 Reply Last reply
    0
    • Axel SpoerlA Offline
      Axel SpoerlA Offline
      Axel Spoerl
      Moderators
      wrote last edited by
      #2

      Hi Robert,

      Qt Creator sets environment variables on project level, not globally.
      You can set a different environment for building and running.
      Go project configuration, chose build or run settings and specify additional variables in the "Environment" section.
      Check the documentation for more information.

      Cheers
      Axel

      Software Engineer
      The Qt Company, Oslo

      1 Reply Last reply
      1
      • R Robert Hairgrove

        This concerns runtime environment.

        Question: I know how to set environment variables in Qt Creator "Preferences". But does Qt Creator set any runtime environment variables of its own when an application is started in Qt Creator, as opposed to a deployed environment without Qt Creator?

        It would be nice if I could just query an existing variable instead of having to set it myself. That way, other developers would not have to remember to do this when they are maintaining my application.

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote last edited by JonB
        #3

        @Robert-Hairgrove said in Qt Creator and environment variables on Windows:

        But does Qt Creator set any runtime environment variables of its own when an application is started in Qt Creator, as opposed to a deployed environment without Qt Creator?

        All as @Axel-Spoerl has written, you can set your own from Creator. But are you asking specifically whether there is an environment variable auto-set by Creator when running from Creator, which you could test in your code if you want to know this? Because that was asked recently-ish and IIRC there is such a variable. Is that what you want, do you want me to go see if I can dig out the thread?

        ...OK, I couldn't resist, so I did a search. Surprise, surprise, it was your question! How to determine at runtime whether app is running launched by Qt Creator?. We talked about environment variables QTC_RUN or _QTC_Path. Your question sounds to me like you are asking about this again, or is the angle here rather different?

        Axel SpoerlA 1 Reply Last reply
        1
        • JonBJ JonB

          @Robert-Hairgrove said in Qt Creator and environment variables on Windows:

          But does Qt Creator set any runtime environment variables of its own when an application is started in Qt Creator, as opposed to a deployed environment without Qt Creator?

          All as @Axel-Spoerl has written, you can set your own from Creator. But are you asking specifically whether there is an environment variable auto-set by Creator when running from Creator, which you could test in your code if you want to know this? Because that was asked recently-ish and IIRC there is such a variable. Is that what you want, do you want me to go see if I can dig out the thread?

          ...OK, I couldn't resist, so I did a search. Surprise, surprise, it was your question! How to determine at runtime whether app is running launched by Qt Creator?. We talked about environment variables QTC_RUN or _QTC_Path. Your question sounds to me like you are asking about this again, or is the angle here rather different?

          Axel SpoerlA Offline
          Axel SpoerlA Offline
          Axel Spoerl
          Moderators
          wrote last edited by Axel Spoerl
          #4

          @JonB said in Qt Creator and environment variables on Windows:

          an environment variable auto-set by Creator

          Just write a launcher script that sets a variable before starting Creator.

          @echo off
          set LAUNCHED_BY_QT_CREATOR=1
          start "" "C:\Qt\Tools\QtCreator\bin\qtcreator.exe"
          pause
          

          Software Engineer
          The Qt Company, Oslo

          JonBJ 1 Reply Last reply
          0
          • Axel SpoerlA Axel Spoerl

            @JonB said in Qt Creator and environment variables on Windows:

            an environment variable auto-set by Creator

            Just write a launcher script that sets a variable before starting Creator.

            @echo off
            set LAUNCHED_BY_QT_CREATOR=1
            start "" "C:\Qt\Tools\QtCreator\bin\qtcreator.exe"
            pause
            
            JonBJ Offline
            JonBJ Offline
            JonB
            wrote last edited by JonB
            #5

            @Axel-Spoerl
            Hi Axel. OP wrote:

            It would be nice if I could just query an existing variable instead of having to set it myself. That way, other developers would not have to remember to do this when they are maintaining my application.

            So for his purposes he does not want (other) people to have to set an environment variable explicitly or by wrapping this in a .bat file or similar, presumably.

            The more I read the question as phrased the more it seems to be the same as his linked previous question. I think we need to know just what he wants to answer best.

            1 Reply Last reply
            0

            • Login

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