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

Adam Brenner aebrenne at uci.edu
Tue Nov 5 11:42:27 PST 2013


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
    In file included from main.cpp:1:
    In file included from /data/apps/gcc/4.8.1/include/c++/4.8.1/iostream:39:
    In file included from /data/apps/gcc/4.8.1/include/c++/4.8.1/ostream:38:
    In file included from /data/apps/gcc/4.8.1/include/c++/4.8.1/ios:38:
    In file included from /data/apps/gcc/4.8.1/include/c++/4.8.1/iosfwd:39:
    In file included from
/data/apps/gcc/4.8.1/include/c++/4.8.1/bits/stringfwd.h:40:
    /data/apps/gcc/4.8.1/include/c++/4.8.1/bits/memoryfwd.h:50:15:
error: expected '{'
    namespace std _GLIBCXX_VISIBILITY(default)
                  ^
    /data/apps/gcc/4.8.1/include/c++/4.8.1/bits/memoryfwd.h:50:15:
error: C++ requires a type specifier for all declarations
    namespace std _GLIBCXX_VISIBILITY(default)
                  ^~~~~~~~~~~~~~~~~~~
    /data/apps/gcc/4.8.1/include/c++/4.8.1/bits/memoryfwd.h:50:35:
error: expected expression
    namespace std _GLIBCXX_VISIBILITY(default)
                                      ^
    /data/apps/gcc/4.8.1/include/c++/4.8.1/bits/memoryfwd.h:50:43:
error: expected ';' after top level declarator
    namespace std _GLIBCXX_VISIBILITY(default)
                                              ^

[1]: http://modules.sourceforge.net

--
Adam Brenner
Computer Science, Undergraduate Student
Donald Bren School of Information and Computer Sciences

Research Computing Support
Office of Information Technology
http://www.oit.uci.edu/rcs/

University of California, Irvine
www.ics.uci.edu/~aebrenne/
aebrenne at uci.edu



More information about the cfe-users mailing list