[cfe-users] G++ & Clang++ - namespace std _GLIBCXX_VISIBILITY(default)

Dmitri Gribenko gribozavr at gmail.com
Mon Nov 11 15:30:48 PST 2013


On Tue, Nov 5, 2013 at 11:42 AM, Adam Brenner <aebrenne at uci.edu> wrote:
> I am trying to compile my C++ code using `clang++` but keep getting this error
> with the conflicting namespace. My main.cpp file is a simple Hello World
> program (for debugging).
>
> I have a feeling the issue is related to a lack of includes or environment
> variables I need to set up. On our HPC cluster, I am using the module's
> system[1] but for the purpose of debugging, everything is being done via the
> command line.
>
>
>     [aebrenne at hpc src]$ gcc -v
>     Using built-in specs.
>     COLLECT_GCC=gcc
>     COLLECT_LTO_WRAPPER=/data/apps/gcc/4.8.1/libexec/gcc/x86_64-unknown-linux-gnu/4.8.1/lto-wrapper
>     Target: x86_64-unknown-linux-gnu
>     Configured with: ./configure --with-gmp=/data/apps/gmp/5.1.2
> --with-mpfr=/data/apps/mpfr/3.1.2 --with-mpc=/data/apps/mpc-1.0.1
> --enable-threads=posix --with-as=/data/apps/binutils/2.23.2/bin/as
> --mandir=/data/apps/gcc/4.8.1/man --pdfdir=/data/apps/gcc/4.8.1/pdf
> --htmldir=/data/apps/gcc/4.8.1/html
> --enable-languages=c,c++,fortran,ada,go,java,lto,objc,obj-c++
> --prefix=/data/apps/gcc/4.8.1
>     Thread model: posix
>     gcc version 4.8.1 (GCC)
>
>     [aebrenne at hpc src]$ clang++ --version
>     clang version 3.4 (trunk 193367)
>     Target: x86_64-unknown-linux-gnu
>     Thread model: posix
>     [aebrenne at hpc src]$
>
>
>     [aebrenne at hpc src]$ cat main.cpp
>     #include <iostream>
>
>     int main() {
>     std::cout << "Starting test..." << std::endl;
>
>     return 0;
>     }
>     [aebrenne at hpc src]$ clang++ -std=c++11 -Wall -g
> -I/data/apps/gcc/4.8.1/include/c++/4.8.1  main.cpp

Hi Adam,

I don't think this is the correct way to do this.  Pass
-DGCC_INSTALL_PREFIX=... to cmake invocation to hardcode GCC directory
into Clang binary, or use -gcc-toolchain=... on the command line.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the cfe-users mailing list