[cfe-dev] clang cannot find standard template library

Pål Dahle pal.dahle at nr.no
Tue Jun 15 07:06:50 PDT 2010


Hi.

Looking for an alternative to g++, I have stumbled across
clang. And, impressively, clang has managed to compile my
C++ code consisting of some 80 000 lines of code.

However, when it comes to linking, things stop. It seems
that clang does not find the standard template library.

As a matter of fact, even the trivial

#include <iostream>
int main () { std::cout << "Hello world." << std::endl; }

ends it's compilation with the following error message:

nebuchadnezzar:/opt/project/Cohiba/trunk/cohiba/tmp$ clang test.cpp
/tmp/cc-jpZ3sj.o: In function `__cxx_global_var_init':
test.cpp:(.text+0x18): undefined reference to `std::ios_base::Init::Init()'
test.cpp:(.text+0x20): undefined reference to `std::ios_base::Init::~Init()'
/tmp/cc-jpZ3sj.o: In function `main':
test.cpp:(.text+0x63): undefined reference to `std::cout'

[snip]

Can anyone give me a hint where to look? I have tried
the manual pages, but that didn't bring me any further.

By the way, I'm using the clang provided bu Ubuntu 10.04

Best regards
Pål





More information about the cfe-dev mailing list