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 fails to import VS variables
Forum Updated to NodeBB v4.3 + New Features

QT Creator fails to import VS variables

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
4 Posts 2 Posters 2.4k 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.
  • C Offline
    C Offline
    chadw
    wrote on last edited by chadw
    #1

    I've got Microsoft Visual Studio 2017 Community Edition, latest QT version (5.9.2) with QtCreator (4.4.1) but unless I run the batch file to setup a 64 bit environment (ie "vcvarsall.bat amd64") [1] from the Qt command prompt and then run QtCreator, I get timeout issues in QtCreator.

    Basically starting QtCreator from the start menu, it becomes unresponsive for over a minute before complaining:

    error: Failed to retrieve MSVC Environment from "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat amd64":
    The command "C:\WINDOWS\system32\cmd.exe" could not be started.

    On closer examination, QtCreator is missing a host of environment variables such as those beginning with:

    VC..
    VS..
    WindowsSDK..

    This error repeats for most common actions, often adding a 60sec+ delay.

    If I could understand how QtCreator imports the system variables then maybe I could make progress with this. Right now, there is precious little information available to assist on the web.

    [1] The full command running the batch file on the Qt command prompt is:

    "\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary"\Build\vcvarsall.bat amd64

    1 Reply Last reply
    0
    • aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi @chadw
      Creator needs to run this batch file to detect the VS compilers. For some users, this seems problematic. See https://bugreports.qt.io/browse/QTCREATORBUG-19099 for more info and hints for possible solution.

      Qt has to stay free or it will die.

      1 Reply Last reply
      2
      • C Offline
        C Offline
        chadw
        wrote on last edited by
        #3

        Thank you very much for your reply aha_1980.

        To answer the suggestions of that link:

        C:\Windows\System32\cmd.exe and QT's cmd prompt take <1 sec. There are 16 entries in my PATH, all are fully qualified (ie begin "c:...") and none are junk or network paths. I've doublechecked each directory, they all exist.

        It (consistently) takes 9s to run "...\vcvarsall.bat amd64", so that's more than the 5s Tobias Hunger mentions. I thought that would be ok as QtCreator waits for over a minute before throwing the error..? Maybe that's the smoking gun here?

        VS itself seems fine as far as I can tell. No errors during the installation. I can build/compile/run code fine both within the VS IDE and from the cmd line. Handling Qt project is fine both from the command line and QtCreator (assuming I manually load the batch file before running QtCreator).

        I don't know enough to start messing with the registry (IT would kill me if I screwed up the PC). But the path beginning HKCU doesn't exist on this machine. Is there any information regarding debugging auto-start things loaded when cmd.exe is started? It's the loading of the batch file that seemingly adds the delay, since running (non VS-)cmd prompts takes barely a second.

        The simplest thing (me to) though would be increasing the timeout before QtCreator gives up on loading vcvarsall.bat. Although why it would take over a minute to effectively give up, is odd if it "only" takes 9 seconds to load the batch file manually..

        1 Reply Last reply
        0
        • aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi @chadw,

          I cannot really help you with this issue. Please add a comment to the mentioned bug report with the information from your last post. We need to gather as much information as possible to solve this issue.

          It (consistently) takes 9s to run "...\vcvarsall.bat amd64", so that's more than the 5s Tobias Hunger mentions. I thought that would be ok as QtCreator waits for over a minute before throwing the error..? Maybe that's the smoking gun here?

          Just guessing: maybe the script is even slower within Creator or it doesn't start at all? BTW: I don't read 1 minute in the report, I saw Tobias mention 30 seconds.

          I know this all does not really help you, but I'm with Tobias that the timeout is large enough. Event 9 seconds is still very long.

          PS: HKCU is the common acronym for HKEY_CURRENT_USER :)

          Qt has to stay free or it will die.

          1 Reply Last reply
          1

          • Login

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