mac error: pair is not a template

I am a new beginer on Mac

I have already installed the PGI on my macbook, and have a test with pgc++, but my code can’t be compiled

my code is

#include <iostream>

#ifdef _OPENACC
#include <openacc.h>
#endif
using namespace std;

int main() {
#ifdef _OPENACC
    const int N = 1024;
    //定义
    int i, a[N], b[N], c[N];

    for (i = 0; i < N; i++) {
        c[i] = 0;
        a[i] = b[i] = i;//�始化a数组
    }

#pragma acc kernels
    for (i = 0; i < N; i++) {
        c[i] = b[i] + a[i];
    }
#else
    cout << "not support OpenACC" << endl;

#endif

    std::cout << c[1] << std::endl;
    return 0;
}

and the wrong info is:


MacBook13:TestOpenCV Chen$ pgc++ -acc -std=c++11 -Minfo main.cpp
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
          /usr/bin/../include/c++/v1/__tuple", line 93: error: pair is not a
          template
  template <class _T1, class _T2> struct __tuple_like<pair<_T1, _T2> > : true_type {};
                                                      ^

"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
          /usr/bin/../include/c++/v1/__tuple", line 97: error: pair is not a
          template
  typename tuple_element<_Ip, pair<_T1, _T2> >::type&
                              ^

"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
          /usr/bin/../include/c++/v1/__tuple", line 98: error: pair is not a
          template
  get(pair<_T1, _T2>&) _NOEXCEPT;
      ^

"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
          /usr/bin/../include/c++/v1/__tuple", line 102: error: pair is not a
          template
  const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
                                    ^

"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
          /usr/bin/../include/c++/v1/__tuple", line 103: error: pair is not a
          template
  get(const pair<_T1, _T2>&) _NOEXCEPT;
            ^

"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
          /usr/bin/../include/c++/v1/__tuple", line 108: error: pair is not a
          template
  typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
                              ^

"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
          /usr/bin/../include/c++/v1/__tuple", line 109: error: pair is not a
          template
  get(pair<_T1, _T2>&&) _NOEXCEPT;
      ^

7 errors detected in the compilation of "main.cpp".

How can I resolve it? wish for your help~~I am a new on macbook

Hi HiJacker,

I’m not a Mac person either, but the error seems to indicate that your Xcode version doesn’t support C++11. Does the code compile without "-std=c++11?

What Xcode version are you using and which PGI compiler version?

Note that the PGI 2017 release for macOS no longer supports CUDA Fortran and OpenACC running on GPUs or CUDA-x86 running on CPUs. OpenACC targeting multi-core CPUs is still supported using the -ta sub-options host and multicore. The -acc option now implies -ta=multicore on macOS.

-Mat

Thank you for your reply, and know I have changed to C language, but your reply is also useful for me~