windows安装clang

来源:互联网 发布:康佳lc47d560dc 网络 编辑:程序博客网 时间:2024/06/05 05:39

一、下载并安装最新版clang (for windows)

地址:http://www.llvm.org/releases/download.html

安装时选中添加 LLVM 到 path。

二、编译代码。

有 tmp.cc,内容如下:

#include <iostream>#include <vector>using namespace std;int main(){vector<int> v;for (int i = 0; i < 5; ++i)v.push_back(i);if (1 == 1) {cout << "This is 1" << endl;cout << "too many spaces" << endl;} else {cout << "haha else!" << endl;}cout << "end" << endl;for (auto &x : v)cout << &x << ' ';cout << endl;for (auto x : v)cout << &x << ' ';cout << endl;}


编译命令为:
clang++ -Xclang -flto-visibility-public-std -std=c++14 tmp.cc

clang-cl tmp.cc

(参考:https://stackoverflow.com/questions/42545078/clang-version-5-and-lnk4217-warning)

原创粉丝点击