clang“hello,world!”链接错误 [英] clang "hello, world!" link errors in windows

查看:715
本文介绍了clang“hello,world!”链接错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚下载了CLang源代码,使用CMake创建了一个Visual C ++ 10 IDE工作区,并从Visual C ++ 10.0(express)创建了所有的东西。

I just downloaded the CLang sources, made a Visual C++ 10 IDE workspace by using CMake, and built everything from Visual C++ 10.0 (express).

hello world上的一系列链接器错误:

Now I get a bunch of linker errors on hello world:


d:\dev\test> type con >foo.cpp
#include <iostream>
using namespace std;
int main() { cout << "Hello, cling-clong world!" << endl; }
^Z

d:\dev\test> clang++ foo.cpp
foo-839435.o : error LNK2019: unresolved external symbol __ZSt4cout referenced in function _main
foo-839435.o : error LNK2019: unresolved external symbol __ZdlPv referenced in function __ZNSt14error_categoryD0Ev
foo-839435.o : error LNK2019: unresolved external symbol __ZSt18uncaught_exceptionv referenced in function __ZNSo6sentry
D2Ev
foo-839435.o : error LNK2019: unresolved external symbol ___cxa_rethrow referenced in function __ZNSt8ios_base5clearEib
foo-839435.o : error LNK2019: unresolved external symbol ___cxa_allocate_exception referenced in function __ZNSt8ios_base5clearEib
foo-839435.o : error LNK2019: unresolved external symbol ___cxa_throw referenced in function __ZNSt8ios_base5clearEib
foo-839435.o : error LNK2019: unresolved external symbol __ZSt17iostream_categoryv referenced in function __ZSt15make_er

那么我能做些什么呢?

推荐答案

如果你想在Windows上试验Clang,我建议使用MinGW内置版本,像我在这里提供的(或自己使用你喜欢的MinGW工具链构建它):

If you want to experiment with Clang on Windows, I suggest using a MinGW built version, like the one I provide here (or build it yourself using your favourite MinGW toolchain):

64位

您将需要 gcc clang 包(那些没有linux / mac / cygwin后缀),并提取它们到同一目录。 Clang使用gcc链接,并可以链接到GCC的libstdc ++,几乎允许访问C ++标准库。异常适用于32位版本。我没有运气调试信息,虽然。

You will need both the gcc and clang packages (those without linux/mac/cygwin suffixes) and extract them to the same directory. Clang uses gcc to link, and can link to GCC's libstdc++, pretty much giving you access to the C++ standard library. Exceptions work for the 32-bit version. I haven't had any luck with debug info though.

工作正在做出更好的MS支持Clang,但它是一个缓慢进行的任务。

Work is being done to bring better MS support to Clang, but it's a slowly progressing task.

这篇关于clang“hello,world!”链接错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆