Qt Creator IDE和MSVC 2015编译器组合使用(不想完整安装VS2015)

出发点是不想完整安装VS2015,只想安装C++编译器,然后提供给Qt Creator使用。

也就是说Windows下开发应用或库时,如果不想安装完整的Visual Studio,可以选择只安装Visual C++ Build Tools即可。

The Microsoft Visual C++ Build Tools installs only the command-line compiler, tools, and libraries you need to build C and C++ programs. It's perfect for build labs or classroom exercises and installs relatively quickly. To install only the command-line tools, download and install  Microsoft Visual C++ Build Tools 2015 .
 
The following tools can help you to build a C/C++ project on the command line.
1. CL
Use the compiler (cl.exe) to compile and link source code files into apps, libraries, and DLLs.
2. Link
Use the linker (link.exe) to link compiled object files and libraries into apps and DLLs.
3. MSBuild (Visual C++)
Use MSBuild (msbuild.exe) to build Visual C++ projects and Visual Studio solutions. This is equivalent to running the Build project or Build Solution command in the Visual Studio IDE.
4. DEVENV
Use DEVENV (devenv.exe) combined with a command-line switch—for example, /Build or /Clean—to perform certain build commands without displaying the Visual Studio IDE.
5. NMAKE
Use NMAKE (nmake.exe) to automate tasks that build Visual C++ projects by using a traditional makefile.

第一:在链接 https://visualstudio.microsoft.com/zh-hans/vs/older-downloads/,找到了可再发行组件和生成工具:
Microsoft Visual C++ 2015 Redistributable 更新 3
Microsoft 生成工具 2015 更新 3
我们顺序安装。需要注意的一点是,在安装VS2015的生成工具的时候,请选择默认安装,默认的是winSDK 8.1。

visualcppbuildtools_full.exe默认是在线安装,我们也可以设置成离线安装:

visualcppbuildtools_full.exe /layout d:\vs2015

第二,安装用于程序调试的WinDbg调试器,微软官方把WinDbg调试器隐含到Windows SDK 8.1中了,所以要安装Windows SDK。
下载链接: https://developer.microsoft.com/en-us/windows/downloads/sdk-archive选择Windows 8.1版本安装,注意只需要装Debugging Tools for Windows。
firecat注:我是全部完整地安装了Windows SDK 8.1。

VS调试时,只使用自己带的调试器,不会使用WinDbg。WinDbg安装目录包含有CDB。CDB可以提供给Qt Creator调用。

第三,安装QT(也要注意下载MSVC2015版本的QT)选择32位和64位的版本之后默认安装即可。

第四:安装完成后系统会自动检测到QT versions,Compilers,Debuggers等,然后在Qt Creator配置好kit。

Qt Creator IDE和MSVC 2015编译器组合使用(不想完整安装VS2015)_第1张图片

第五:网上下载ucrtbased.dll库文件

把32位的ucrtbased.dll拷贝到C:\Windows\SysWOW64目录
把64位的ucrtbased.dll拷贝到C:\Windows\System32目录

第六:源码编码格式

注意: Qt Creator -> Options -> Text Editor -> Behavior -> File Encodings 更改设置为 "UTF-8",BOM设置为"Add If Encoding Is UTF-8",这样才能正确识别中文。总之VC++编译器只能识别ANSI和UTF-8+BOM这两种编码。不识别UTF-8。

 

---

友情链接,我的另一篇博客:

CDB调试器使用技巧与心得,重点是Symbols Path设置

 

你可能感兴趣的:(Qt技术,VC++/MFC)