Error compiling with GNU C++ 6 headers

I’ve just installed a PGI 16.10 community version on my Ubuntu 16.10 x64.

Then I write a “hello world” program to test whether the compiler works well.

#include <iostream>

using namespace std;

int main() {
	cout << "Hello PGI" << endl;
	return 0;

Then I use “$ pgc++ -o test.out” and I get the following error messages:

"/usr/include/c++/6/exception", line 64: error: expected a ";"
      virtual ~exception() _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT;
"/usr/include/c++/6/exception", line 69: error: expected a ";"
"/usr/include/c++/6/exception", line 81: error: expected a ";"
      virtual ~bad_exception() _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT;
"/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<char>& __is, basic_string<char>& __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 ";"
      virtual ~logic_error() _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT;
"/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 ";"
      virtual ~runtime_error() _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT;
"/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 "".

It seems that the g++ 6 headers are not correctly supported within the compiler. However, from the release information,

It says

PGI C++ Compiler
Comprehensive support of C++14, requires GCC version 5.0 or greater; full interoperability with GCC 5.1

. So I assume it should work with g++ 6 headers.

Could someone help me with this problem?

I’ve found that PGI 16.10 does not support gcc-6, and it works fine with gcc-5.4.0. What I have done to solve this problem is to build a gcc-5.4.0 on my home folder and then configure PGI compiler with the gcc 5.4.0.

The configuration process could be found at

I would like to close this problem but I don’t know how to do that. Sorry for the inconvenience.

Our next release, PGI 17.1, currently due out in January 2017, will support GNU 6.0 and 6.1 headers.