如何在 Qt Creator 中使用 Windows SDK
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3791808/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I use the Windows SDK with Qt Creator
提问by Cev
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
?
我一直在尝试在 Qt Creator 中使用 Windows SDK v7.1,但运气不佳。具体来说,我如何设置 Qt Creator 以便它编译 SDK 示例C:\Program Files\Microsoft SDKs\Windows\v7.1\Samples
?
采纳答案by Piotr Dobrogost
Create new project in Qt Creator using File|New File or Project, choose Other Projectfrom Projectslist and then choose Import Existing Projectanc click Choose...button. Then select the folder with SDK example, click Nextand click Finish. Click Projectson the left (or press Ctrl+5), and in Tool chaincombo choose Microsoft Visual C++. Now click Detailsunder Build Environment, check Clear system environmentand variables and their values as below:
使用File|New File 或 Project在 Qt Creator 中创建新项目,从项目列表中选择其他项目,然后选择导入现有项目,然后单击选择...按钮。然后选择带有 SDK 示例的文件夹,单击Next并单击Finish。单击左侧的项目(或按 Ctrl+5),然后在工具链组合中选择Microsoft Visual C++。现在单击Build Environment下的Details,检查清除系统环境和变量及其值,如下所示:
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).
您应该根据您的设置(安装 Visual C++ 的位置和安装 Windows SDK 的位置)修改上述值。
Now click Build All(or press Ctrl+Shift+B) and the example should be built.
现在单击Build All(或按 Ctrl+Shift+B),应该会构建示例。