[cfe-dev] weakref declaration must have internal linkage

NAKAMURA Takumi geek4civic at gmail.com
Tue Oct 11 02:58:16 PDT 2011


2011年10月11日 14:33:23 UTC+9 The Dragon Book <thedragonbook at gmail.com>:
> I am building a simple c++ program using clang++ and I am getting errors
> like below. I have added the gcc include paths manually as specified in the
> clang website. How do I resolve these?
> In file included from a2.cpp:1:
> In file included from /usr/include/c++/4.1.2/vector:65:
> In file included from /usr/include/c++/4.1.2/bits/stl_algobase.h:69:
> In file included from /usr/include/c++/4.1.2/iosfwd:45:
> In file included from
> /usr/include/c++/4.1.2/i386-redhat-linux/bits/c++io.h:38:
> In file included from
> /usr/include/c++/4.1.2/i386-redhat-linux/bits/gthr.h:132:
> /usr/include/c++/4.1.2/i386-redhat-linux/bits/gthr-default.h:100:1: error:
> weakref declaration must have internal linkage
> __gthrw(pthread_once)
> ^
> /usr/include/c++/4.1.2/i386-redhat-linux/bits/gthr-default.h:81:23: note:
> expanded from:
> #define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name)
>                       ^
> /usr/include/c++/4.1.2/i386-redhat-linux/bits/gthr-default.h:72:46: note:
> expanded from:
>   extern __typeof(type) name __attribute__ ((__weakref__(#name2))); \

I assume you are using RHEL5 (or clone).
Did you try to install "gcc44-c++"?
Clang++ does not accept g++-4.1 headers.

...Takumi



More information about the cfe-dev mailing list