Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. [SOLVED]Using windows' environmental variables in the Qt code

[SOLVED]Using windows' environmental variables in the Qt code

Scheduled Pinned Locked Moved Installation and Deployment
3 Posts 2 Posters 1.3k 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.
  • D Offline
    D Offline
    dndeed
    wrote on 17 Jun 2014, 12:34 last edited by
    #1

    Hi.

    I have a piece of code that needs to be able to access my environmental variables to create a path. I know how to make it work in the .pro file (INCLUDEPATH += "$$(NTTOOLS)/libcurl/trunk/include/curl" where NTTOOLS is the name of my variable) but I cannot seem to get it so I can access that variable in the actual c++ code.

    I have tried creating a variable in the .pro file that is equal to NTTOOLS and then using that in the code, but it's not working.

    Is there a way to view environmental variables in the code? if not, how do I access variables created in the pro file? I have looked online for this but haven't found much.

    Thanks in advance!

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andreyc
      wrote on 17 Jun 2014, 14:39 last edited by
      #2

      For runtime access to the environment variable take a look on "qgetenv()":http://qt-project.org/doc/qt-5/qtglobal.html#qgetenv

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dndeed
        wrote on 17 Jun 2014, 14:44 last edited by
        #3

        Perfect! Thank you, I knew there had to be an easy way to do it.

        1 Reply Last reply
        0

        1/3

        17 Jun 2014, 12:34

        • Login

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