[cfe-dev] clang cannot find standard template library
Jean-Daniel Dupas
devlists at shadowlab.org
Tue Jun 15 08:28:27 PDT 2010
Le 15 juin 2010 à 16:06, Pål Dahle a écrit :
> 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
Use clang++ instead of clang (although this is a symlink on clang, the driver detect that it was invoked using a command containing ++ and switch to c++ mode).
-- Jean-Daniel
More information about the cfe-dev
mailing list