pgc++ compilation error

I am using pgi 2016 version on ubuntu 16.10. I compiled a simple program
by using the following command

pgc++ prog1.cpp

and got the error. Please let me know why it is happening and what is the solution?


using namespace std;

int main()
cout << “Hello World!” << endl;
return 0;

pgc++ prog1.cpp

“/usr/include/c++/6/exception”, line 64: error: expected a “;”

“/usr/include/c++/6/exception”, line 69: error: expected a “;”

“/usr/include/c++/6/exception”, line 81: error: expected a “;”

“/usr/include/c++/6/exception”, line 85: error: expected a “;”

“/usr/include/c++/6/bits/basic_string.h”, line 381: error: expected a “;”

“/usr/include/c++/6/bits/basic_string.h”, line 5289: error: expected a “;”

“/usr/include/c++/6/bits/basic_string.h”, line 5312: error: “operator>>” is not
a class or function template name in the current scope
operator>>(basic_istream& __is, basic_string& __str);

“/usr/include/c++/6/bits/basic_string.tcc”, line 348: error: declaration is
incompatible with “void std::__cxx11::basic_string<_CharT, _Traits,
_Alloc>::resize(std::__cxx11::basic_string<_CharT, _Traits,
_Alloc>::size_type)” (declared at line 827 of
resize(size_type __n, _CharT __c)

“/usr/include/c++/6/stdexcept”, line 120: error: expected a “;”
logic_error(const string& __arg) _GLIBCXX_TXN_SAFE;

“/usr/include/c++/6/stdexcept”, line 132: error: expected a “;”

“/usr/include/c++/6/stdexcept”, line 137: error: expected a “;”

“/usr/include/c++/6/stdexcept”, line 150: error: expected a “;”
explicit domain_error(const string& __arg) _GLIBCXX_TXN_SAFE;

“/usr/include/c++/6/stdexcept”, line 161: error: expected a “;”
explicit invalid_argument(const string& __arg) _GLIBCXX_TXN_SAFE;

“/usr/include/c++/6/stdexcept”, line 173: error: expected a “;”
explicit length_error(const string& __arg) _GLIBCXX_TXN_SAFE;

“/usr/include/c++/6/stdexcept”, line 185: error: expected a “;”
explicit out_of_range(const string& __arg) _GLIBCXX_TXN_SAFE;

“/usr/include/c++/6/stdexcept”, line 204: error: expected a “;”
runtime_error(const string& __arg) _GLIBCXX_TXN_SAFE;

“/usr/include/c++/6/stdexcept”, line 216: error: expected a “;”

“/usr/include/c++/6/stdexcept”, line 221: error: expected a “;”

“/usr/include/c++/6/stdexcept”, line 233: error: expected a “;”
explicit range_error(const string& __arg) _GLIBCXX_TXN_SAFE;

“/usr/include/c++/6/stdexcept”, line 244: error: expected a “;”
explicit overflow_error(const string& __arg) _GLIBCXX_TXN_SAFE;

“/usr/include/c++/6/stdexcept”, line 255: error: expected a “;”
explicit underflow_error(const string& __arg) _GLIBCXX_TXN_SAFE;

21 errors detected in the compilation of “prog1.cpp”.


I ran 16.10 pgfortran on an Ubuntu1604 system and

pgc++ hello.cpp -o hello_pgc++

compiled without issue. Make sure that g++ compiles your code
properly. If you installed the PGI compilers before you upgraded
the g++ or Linux version, you will need to reinstall the compilers again.

I will ask for an Ubuntu1610 system be created, but it may
take a little time.


Hello @jtull

when I compile my program with

g++ hello.cpp -o hello_g++

it goes fine but when I try to compile with

pgc++ hello.cpp -o hello_pgc++

I got compilation errors.

Hi fazzy1,

What version of GNU do you have installed? PGI 16.10 is compatible with GNU 5.1 or earlier but it looks like you might be using GNU 6.0. 6.0 support should be available next year.

  • Mat

Yes, I think the gcc version is 6.something and I don’t know if we handle the
gcc 6 headers with 16.10.

gcc --version

to determine.

Engineering says Ubuntu1610 uses gcc 6.1.1 .