g++ miss static variable for C++ OpenMP while gcc working well. testcase a.c attached to show the problem. static variable shrd is not found during linking.
micro# g++ a.c -fopenmp Undefined first referenced symbol in file main::shrd /tmp/ccqOSjqL.o micro# gcc a.c -fopenmp micro# gcc -v Using built-in specs. Target: sparc-sun-solaris2.10 Configured with: /import/dr2/starlex/orig/trunk/configure --prefix=/import/dr3/s10/gcc-4.3/ --enable-languages=c,c++,fortran --disable-gnattools --with-mpfr=/ws/gccfss/tools --with-gmp=/ws/gccfss/tools Thread model: posix gcc version 4.3.0 20070912 (experimental) (GCC) -- Summary: static variable not found for C++ OpenMP Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: hailijuan at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34513