[LLVMbugs] [Bug 8121] New: clang doesn't find STL headers and library

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Sep 9 07:28:38 PDT 2010


           Summary: clang doesn't find STL headers and library
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: bero at arklinux.org
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com

This is with a current checkout of the 2.8 branch (that version isn't listed in

Not sure if this is a bug or a feature [e.g. to make it easier to use libc++ or
some other alternative STL], but it's unexpected:

[bero at matterhorn ~]$ cat >test.cpp
#include <iostream>
int main(int argc, char **argv) {
        std::cout << "Test" << std::endl;
[bero at matterhorn ~]$ clang test.cpp
test.cpp:1:10: fatal error: 'iostream' file not found
#include <iostream>
1 error generated.
[bero at matterhorn ~]$ clang -I/usr/include/c++/4.5.1
-I/usr/include/c++/4.5.1/x86_64-unknown-linux-gnu test.cpp
/tmp/cc-6CmGWX.o: In function `__cxx_global_var_init':
test.cpp:(.text+0xc): undefined reference to `std::ios_base::Init::~Init()'
test.cpp:(.text+0x30): undefined reference to `std::ios_base::Init::Init()'
/tmp/cc-6CmGWX.o: In function `main':
test.cpp:(.text+0x60): undefined reference to `std::basic_ostream<char,
std::char_traits<char> >& std::endl<char, std::char_traits<char>
>(std::basic_ostream<char, std::char_traits<char> >&)'
test.cpp:(.text+0x6b): undefined reference to `std::cout'
test.cpp:(.text+0x91): undefined reference to `std::basic_ostream<char,
std::char_traits<char> >& std::operator<< <std::char_traits<char>
>(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
test.cpp:(.text+0x9d): undefined reference to `std::basic_ostream<char,
std::char_traits<char> >::operator<<(std::basic_ostream<char,
std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char>
collect2: ld returned 1 exit status
clang: error: linker (via gcc) command failed with exit code 1 (use -v to see
[bero at matterhorn ~]$ clang -I/usr/include/c++/4.5.1
-I/usr/include/c++/4.5.1/x86_64-unknown-linux-gnu test.cpp -lstdc++
[works as expected]

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list