catastrophic error cannot open source file "iostream&qu

I got this error message trying to compile example s1 after “upgrading” my gnu compiler:

pgc++ -w -Kieee -O2 -o s1 -acc -Minfo=accel s1.cpp
“s1.cpp”, line 8: catastrophic error: cannot open source file “iostream”

I looked up one of the threads and found the answer in one of the previous topic:
you have to modify this file:
/opt/pgi/linux86-64/13.10/bin/localrc

there are entries in there referencing the includes path for the gnu compiler:

set GCCINC=/usr/lib/gcc/x86_64-redhat-linux/4.4.6/include;

4.4.6 was my previous gnu compiler
4.4.7 is the new install.
This means the entries in localrc have to be changed to

set GCCINC=/usr/lib/gcc/x86_64-redhat-linux/4.4.7/include;

For those encountering similar issues…

The install script creates localrc based on interrogating the environment.

% gcc -v hello.c
should indicate what the default gcc version is in your path.

We expect the PGI to use the first gcc in your $PATH.