Tony the Pony
Tony the Pony

Reputation: 41347

Trouble using Qt with Visual Studio

I am looking to do Qt development with Visual Studio 2005.

I have built the Qt libraries for Visual C++ and have downloaded the Qt plug-in using the steps outlined here.

I've set the QTDIR environment variable to point to the newly built Qt environment (C:\Qt\vc).

However, when I start Visual Studio, I get the following message:

  These Qt versions are inaccessible: 
  vc in c:\Qt\vc.
  Make sure that you have read access to all files in your Qt directories.

(And I definitely have read access)

How can I fix this?

Upvotes: 2

Views: 4954

Answers (4)

Winfred Huang
Winfred Huang

Reputation: 372

Addition to the best answer:
It could also possible that your Qt installation is incomplete. This could happen if you install Qt by module-based third-party installers (like OSGeo4W). Qt Visual Studio Add-in detects qmake.exe to locate Qt installation. Therefore, if qmake.exe is absent, it will raise this error.
To resolve the problem, install the module which is named qt5-devel or so.

Upvotes: 1

Philip Daubmeier
Philip Daubmeier

Reputation: 14934

After applying all your possible solutions I still had the same problem when building with Incredibuild.

I investigated the source code of the VS Addin and finally found a way to solve it:

In your Qt folder, you have to create a new dir default under the mkspecs folder, which contains a qmake.conf having the following content:

QMAKESPEC_ORIGINAL=../win32-msvc2012

include(../win32-msvc2012/qmake.conf)

(Replace win32-msvc2012 with the appropriate platform and buildtools)

Upvotes: 1

Dmitry Markin
Dmitry Markin

Reputation: 1205

The similar error can arise in Visual Studio Add-In for Qt 5 when it fails to find proper directory itself (wrong QTDIR?)

The solution is to go to QT5 — Qt Options menu in Visual Studio and point it to the proper c:\...\Qt5xx\qtbase directory.

Note that you can completely delete QTDIR and Qt from PATH environment variable and switch Qt versions from within the Qt Options menu.

Upvotes: 1

Tony the Pony
Tony the Pony

Reputation: 41347

I fixed it. The key is to point QTDIR to the qt directory within the environment, so in my case c:\Qt\vc\qt. The error message is just not very intuitive.

Upvotes: 6

Related Questions