将 Clang 与 MSVC 2010 结合使用
首先我想问一下Clang编译器是否比MSVC默认的编译器更好?我如何将 Clang 与 MSVC 结合使用?例如,我在 MSVC 中编写代码,然后当我点击“构建”时,它会调用 Clang 来构建项目。
First of all, I want to ask if Clang compiler is better than MSVC's default compiler? And how can I use Clang with MSVC? For example, I write code in MSVC then when I hit Build, it call Clang to build the project.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
https://github.com/ishani/ClangVSx
Visual Studio 2010 插件,允许使用 Clang C /C++ 编译器代替 MSVC++。将 VC 项目和构建设置转换为 gcc 友好的命令行参数,以及现有的平台工具(MSVC Linker、Librarian、RC)以完成构建链。
https://github.com/ishani/ClangVSx
AddIn for Visual Studio 2010 that allows use of the Clang C/C++ compiler in place of MSVC++. Translates VC project and build settings into gcc-friendly command line arguments, along with existing platform tools (MSVC Linker, Librarian, RC) to complete the build chain.
在 Windows 上使用 clang 编译器仍被认为处于实验状态。不过,最近已经取得了一些进展。正如我回答类似问题:
Using clang compiler on Windows is still considered to be in experimental state. However, some progress has been made recently. As I answered similar question:
当您告诉 Visual Studio 进行构建时,您可以使用“makefile 项目”让 Visual Studio 调用 makefile(或任何命令行进程)。
我之前已经这样做过,以获得 MSVC 针对非 Windows 嵌入式项目的良好源代码导航。
缺点是您必须手动使 makefile 与项目中的文件保持同步(反之亦然,具体取决于您想要如何看待它)——通常不是一个大问题。
You can use a "makefile project" to have Visual Studio invoke a makefile (or any command-line process) when you tell it to build.
I've done this before to get MSVC's nice source navigation for non-Windows embedded projects.
The drawback is that you have to manually keep the makefile in sync with the files in the project (or vice-versa depending on how you want to look at it) - generally not a huge problem.