[cfe-dev] Running clang on Windows with mingw

Eli Friedman eli.friedman at gmail.com
Sat Jul 10 22:59:33 PDT 2010


On Sat, Jul 10, 2010 at 10:45 PM, Yun Chen <yun.go.chen at gmail.com> wrote:
> Hi
>
> If I compile the following code with command line: clang++ -Xclang
> -triple=i686-pc-mingw32 -isystem
> C:\MinGW\lib\gcc\mingw32\4.4.0\include\c++\mingw32 t.cpp
>
> #include<iostream>
> int main()
> {
>        std::cout<<"Hello world!\n";
> }
>
> The output is:
> C:/Windows/TEMP/cc-000001.o:fake:(.text+0x14): undefined reference to
> `__dso_handle'
> C:/Windows/TEMP/cc-000001.o:fake:(.text+0x3e): undefined reference to
> `__cxa_atexit'
> collect2: ld returned 1 exit status
> clang++: error: linker (via gcc) command failed with exit code 1 (use
> -v to see invocation)
>
> How can I get rid of the link errors?

This is essentially the same thing as
http://llvm.org/bugs/show_bug.cgi?id=7276 ; clang shouldn't be
generating references to __cxa_atexit on Windows.

-Eli




More information about the cfe-dev mailing list