Mingw-packages: clang doesn't compile a simple test program

Created on 13 Nov 2015  路  1Comment  路  Source: msys2/MINGW-packages

$ pacman -S mingw-w64-x86_64-clang mingw-w64-x86_64-libc++ mingw-w64-x86_64-clang-tools-extra mingw-w64-x86_64-compiler-rt

touch test.cpp

#include <sstream>
#include <string>
#include <cstdlib>

int main()
{
        std::istringstream iss("1.1");
        double x;
        iss >> x;
        return EXIT_SUCCESS;
}

$ clang -stdlib=libstdc++ test.cpp
C:\DEV\msys64\tmptest-35009e.o:(.text+0x2b): undefined reference to std::allocator<char>::allocator()' C:\DEV\msys64\tmp\test-35009e.o:(.text+0x3f): undefined reference tostd::__cxx11::basic_string, std::allocator >::basic_string(char const*, std::allocator const&)'
C:\DEV\msys64\tmptest-35009e.o:(.text+0x57): undefined reference to std::__cxx11::basic_istringstream<char, std::char_traits<char>, std::allocator<char> >::basic_istringstream(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::_Ios_Openmode)' C:\DEV\msys64\tmp\test-35009e.o:(.text+0x65): undefined reference tostd::__cxx11::basic_string, std::allocator >::~basic_string()'
C:\DEV\msys64\tmptest-35009e.o:(.text+0x73): undefined reference to std::allocator<char>::~allocator()' C:\DEV\msys64\tmp\test-35009e.o:(.text+0x80): undefined reference tostd::istream::operator>>(double&)'
C:\DEV\msys64\tmptest-35009e.o:(.text+0x9c): undefined reference to std::__cxx11::basic_istringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_istringstream()' C:\DEV\msys64\tmp\test-35009e.o:(.text+0xcb): undefined reference tostd::__cxx11::basic_string, std::allocator >::~basic_string()'
C:\DEV\msys64\tmptest-35009e.o:(.text+0xde): undefined reference to std::allocator<char>::~allocator()' C:\DEV\msys64\tmp\test-35009e.o:(.text+0xf5): undefined reference tostd::__cxx11::basic_istringstream, std::allocator >::~basic_istringstream()'
C:\DEV\msys64\tmptest-35009e.o:(.xdata+0xc): undefined reference to __gxx_personality_seh0' C:\DEV\msys64\tmp\test-35009e.o:(.text[__clang_call_terminate]+0x5): undefined reference to__cxa_begin_catch'
C:\DEV\msys64\tmptest-35009e.o:(.text[__clang_call_terminate]+0xf): undefined reference to `std::terminate()'
clang.exe: error: linker command failed with exit code 1 (use -v to see invocation)

Most helpful comment

One need to use clang++ ....

>All comments

One need to use clang++ ....

Was this page helpful?
0 / 5 - 0 ratings

Related issues

smf- picture smf-  路  7Comments

Alex-Gamper picture Alex-Gamper  路  8Comments

Ralayax picture Ralayax  路  7Comments

WuZhengqiang666 picture WuZhengqiang666  路  3Comments

jagannatharjun picture jagannatharjun  路  3Comments