11

I have been trying to use the Windows SDK v7.1 in Qt Creator without much luck. Specifically, how can I set up Qt Creator so that it will compile the SDK samples in C:\Program Files\Microsoft SDKs\Windows\v7.1\Samples?

Dummy00001
  • 16,630
  • 5
  • 41
  • 63
Cev
  • 1,388
  • 1
  • 13
  • 18
  • If you're trying to use Windows-specific code in Qt, you're almost always doing it wrong (in all but the cases where Qt does not provide a mechanism for what you want to do). – San Jacinto Sep 25 '10 at 00:02
  • Really? I was going to use it because it seems very nice for c++ UI development. See: http://stackoverflow.com/questions/115045/good-c-gui-library-for-windows – Cev Sep 25 '10 at 01:05
  • I think San Jacinto misunderstood your intention and you misunderstood his comment :) If you want to use Qt Creator to write UI for some Win32 API code (like examples in Windows SDK) you sure can do this. See my answer. – Piotr Dobrogost Feb 25 '11 at 10:33

1 Answers1

9

Create new project in Qt Creator using File|New File or Project, choose Other Project from Projects list and then choose Import Existing Project anc click Choose... button. Then select the folder with SDK example, click Next and click Finish. Click Projects on the left (or press Ctrl+5), and in Tool chain combo choose Microsoft Visual C++. Now click Details under Build Environment, check Clear system environment and variables and their values as below:

COMSPEC   C:\Windows\system32\cmd.exe
INCLUDE   C:\Program Files\Microsoft SDKs\Windows\v7.1\Include;c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include;
LIB       C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib;c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib;
PATH      C:\Windows\System32;C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin;c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE;
PROCESSOR_ARCHITECTURE x86

You should modify above values according to your setup (places where you installed Visual C++ and where you installed Windows SDK).

Now click Build All (or press Ctrl+Shift+B) and the example should be built.

Piotr Dobrogost
  • 41,292
  • 40
  • 236
  • 366