Pgc++ 13.2 compiler problem with OpenACC

I have been trying to compile the example (without any editing) from Michael Wolfe’s article(, but, I got error when executing the saxpy_test_data target in his Makefile. Here is the error message from pgc++ 13.2 compiler:

$ make saxpy_test_data
pgc++ -fast -acc -Minfo=accel -c saxpy.cpp
      1, Generating present_or_copy(y[0:n])
         Generating present_or_copyin(n)
         Generating present_or_copyin(a)
         Generating present_or_copyin(x[0:n])
         Accelerator kernel generated
          3, #pragma acc loop gang, vector(256) /* blockIdx.x threadIdx.x */
      1, Generating NVIDIA code
         Generating compute capability 1.0 binary
         Generating compute capability 2.0 binary
         Generating compute capability 3.0 binary
pgc++ -acc -O -c saxpy_main_data.cpp
"saxpy_main_data.cpp", line 1: catastrophic error: cannot open source file
  #include <iostream>

1 catastrophic error detected in the compilation of "saxpy_main_data.cpp".
Compilation terminated.
make: *** [saxpy_main_data.o] Error 2

The saxpy.cpp was compiled sucessfully. But, pgc++ 13.2 met problem with iostream? How to solve this? Any suggestion are welcome.

Thank you!

Hi Minh,

This is an odd error and seems to be a problem with your installation. Can you check that the iostream file exists and that you have read permissions? Also, what version of Linux are you using?

$ ls -l /opt/pgi/linux86-64/13.2/include/CC/iostream
-rw-r--r-- 1 colgrove sw 2751 2013-03-04 08:21 /opt/pgi/linux86-64/13.2/include/CC/iostream

Note that you may need to change the root PGI directory, “/opt/pgi”, to match how it’s installed on your system.

  • Mat

Hi Mat,
Thanks for reply. I have checked my permission to iostream header file.

-rw-rw-r-- 1 mw445520 install 2751 Feb 11 16:14 /rwthfs/rz/SW/PGI/PGI_13.2_SCIENTIFIC_64/linux86-64/13.2/include/CC/iostream

I use Scientific Linux release 6.3 (Carbon).

I have tried with -I to include the CC folder in compiling command, but it failed to link the object files.

pgc++ -acc -o saxpy_test_data saxpy.o saxpy_main_data.o
saxpy_main_data.o: In function `__sti___19_saxpy_main_data_cpp_main':
/./saxpy_main_data.cpp:49: undefined reference to `std::ios_base::_Loc_init::_Loc_init()'
/./saxpy_main_data.cpp:49: undefined reference to `std::ios_base::_Loc_init::~_Loc_init()'
saxpy_main_data.o: In function `std::ios_base::_M_check_exception_mask()':
/rwthfs/rz/SW/PGI/PGI_13.2_SCIENTIFIC_64/linux86-64/2013/include/CC/stl/_ios_base.h:204: undefined reference to `std::ios_base::_M_throw_failure()'
saxpy_main_data.o: In function `std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > > const& std::use_facet<std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > > >(std::locale const&)':
/rwthfs/rz/SW/PGI/PGI_13.2_SCIENTIFIC_64/linux86-64/2013/include/CC/stl/_locale.h:214: undefined reference to `std::locale::_M_use_facet(std::locale::id const&) const'
make: *** [saxpy_test_data] Error 2

Is there any environment variable which I need to set?
Sorry, I am new to pgi compiler.


Hi Minh,

This seems to be some type of installation issue. Do you mind sending this issue to PGI Customer Service ( They’ll be better to help with this issue.

Best Regards,