# NVHPC 25.1: nvc++ cannot find \<iostream\>

**URL:** <https://forums.developer.nvidia.com/t/nvhpc-25-1-nvc-cannot-find-iostream/344548>\
**Category:** nvc, nvc++ and nvfortran\
**Created:** [September 10, 2025, 2:49am UTC](https://forums.developer.nvidia.com/t/nvhpc-25-1-nvc-cannot-find-iostream/344548 "2025-09-10T02:49:57Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![lth112347](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@lth112347](https://forums.developer.nvidia.com/u/lth112347)\
**Post date:** [September 10, 2025, 2:49am UTC](https://forums.developer.nvidia.com/t/nvhpc-25-1-nvc-cannot-find-iostream/344548/1 "2025-09-10T02:49:57Z")

</div>

I am trying to use NVIDIA HPC SDK 25.1 with nvc++ to compile a simple C++ program, but it fails to find . With g++ or nvcc, the same code works fine.

#### **Environment**

- **OS:** CentOS Linux 8

- **GCC version:** 8.5.0 (Red Hat 8.5.0-3)

- **NVHPC version:** 25.1

- **Install path:** /public/software/compiler/nvhpc\_sdk

test.cpp:

#include

int main() {

```auto
std::cout << "Hello from nvc++" << std::endl;

return 0;

```

}

nvcc test.cpp -o test # works, runs and prints “Hello from nvc++”

nvc++ test.cpp -o test # fails

```auto
“test.cpp”, line 1: catastrophic error: cannot open source file “iostream”
1 catastrophic error detected in the compilation of “test.cpp”.

```

Compilation terminated.

[root@admin nccl-tests-2.17.1]# ls /usr/include/c++/8/iostream  
/usr/include/c++/8/iostream

Running nvc++ -### test.cpp shows many --sys\_include paths, but **not** /usr/include/c++/8.

Why does nvc++ fail to detect the system libstdc++ headers by default on CentOS 8?

Do I need to run makelocalrc or some additional configuration to point it to GCC 8.5.0?

Is it recommended to avoid setting CPATH/CPLUS\_INCLUDE\_PATH in the modulefile?

Thanks in advance for your help!

---

<div class="post-metadata">

**Author:** ![MatColgrove](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/matcolgrove/32/14047_2.png) [@MatColgrove](https://forums.developer.nvidia.com/u/MatColgrove)\
**Post date:** [September 10, 2025, 5:46pm UTC](https://forums.developer.nvidia.com/t/nvhpc-25-1-nvc-cannot-find-iostream/344548/2 "2025-09-10T17:46:06Z")

</div>

Hi lth112347 and welcome!

This does seem like a configuration issue. Did the system get updated with the new OS since you’ve used it before or is this a new system?

A bit ago, we switched how the local config files (localrc) are generated in that they now get created for each user, for each system, and each release, the first time the compilers are run.

These files will be found in you home directory under “~/.config/NVIDIA/nvhpc/25.1/localrc.\<hostname\>”. So if the system’s OS got updated, then the previous localrc file could still be there and you can try deleting it, so it gets regenerated the next time you run the compiler.

We can try generating one via makelocalrc and then set the environment variable “NVLOCALRC=” to point to it, if the above doesn’t clear it.

> [root@admin nccl-tests-2.17.1]

Are you running as root?

-Mat

---

<div class="post-metadata">

**Author:** ![tcu](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@tcu](https://forums.developer.nvidia.com/u/tcu)\
**Post date:** [September 10, 2025, 7:55pm UTC](https://forums.developer.nvidia.com/t/nvhpc-25-1-nvc-cannot-find-iostream/344548/3 "2025-09-10T19:55:49Z")

</div>

As another data point, I have seen this kind of issue when an Ubuntu node was added to a cluster that was otherwise all Rocky. Libraries and possibly other files are in different locations, and you need to configure for the new setup.

---

<div class="post-metadata">

**Author:** ![lth112347](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@lth112347](https://forums.developer.nvidia.com/u/lth112347)\
**Post date:** [September 11, 2025, 2:19am UTC](https://forums.developer.nvidia.com/t/nvhpc-25-1-nvc-cannot-find-iostream/344548/4 "2025-09-11T02:19:41Z")

</div>

Thanks! This is a brand-new system, and the NVIDIA HPC SDK (nvhpc 25.1) was freshly installed. The error appears even after regenerating the localrc file as described above.

I already executed:

/public/software/compiler/nvhpc\_sdk/Linux\_x86\_64/25.1/compilers/bin/makelocalrc \

-x /public/software/compiler/nvhpc\_sdk/Linux\_x86\_64/25.1/compilers/bin

and then set the environment variable:

[root@admin ~]# export NVLOCALRC=/public/software/compiler/nvhpc\_sdk/Linux\_x86\_64/25.1/compilers/bin/localrc

[root@admin 4090]# module load compiler/nvhpc/25.1

After that, when I try to compile a simple C++ file:

[root@admin 4090]# nvc++ -o test test.cpp

I still get the following error:

“test.cpp”, line 1: catastrophic error: cannot open source file “iostream”

#include   
^

1 catastrophic error detected in the compilation of “test.cpp”.

This is the content of the localrc file:

[root@admin 4090]# less /public/software/compiler/nvhpc\_sdk/Linux\_x86\_64/25.1/compilers/bin/localrc  
set LFC=-lgfortran;  
set LDSO=/lib64/ld-linux-x86-64.so.2;  
set GCCDIR=;  
set G77DIR=;  
set OEM\_INFO=64-bit target on x86-64 Linux $INFOTPVAL;  
set GNUATOMIC=;  
set GCCINC=;  
set GPPDIR=;  
set NUMALIBNAME=-lnuma;  
set LOCALRC=YES;  
set EXTENSION=extension=;  
set LC=-lgcc -lc -lgcc\_s;  
set DEFCUDAVERSION=12.6;  
set DEFSTDPARCOMPUTECAP=;

GLIBC version 2.28

GCC version 8.5.0

set GCCVERSION=80500;  
set LIBNCURSES=YES;  
export PGI=$COMPBASE;

makelocalrc executed by root 2025年 09月 11日 星期四 10:08:13 CST

/public/software/compiler/nvhpc\_sdk/Linux\_x86\_64/25.1/compilers/bin/localrc (END)

Interestingly, if I use nvcc, I can compile and run the same code successfully.

I also tried reinstalling the SDK, but the problem remains the same.

Could you please advise me on the next steps to resolve this issue?

Thank you very much for your support and for the great work you are doing with the HPC SDK.

---

<div class="post-metadata">

**Author:** ![lth112347](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@lth112347](https://forums.developer.nvidia.com/u/lth112347)\
**Post date:** [September 11, 2025, 10:29am UTC](https://forums.developer.nvidia.com/t/nvhpc-25-1-nvc-cannot-find-iostream/344548/5 "2025-09-11T10:29:41Z")

</div>

I tried installing the same tarball (single install) on a new **Ubuntu 24.04.3** machine. On this system, `nvc++` is able to find the `iostream` header correctly.

In `/opt/nvidia/hpc_sdk/Linux_x86_64/25.1/compilers/bin` I found the `localrc` file, whose contents are:

set LDSO=/lib64/ld-linux-x86-64.so.2;  
set GCCDIR=/usr/lib/gcc/x86\_64-linux-gnu/13/;  
set OEM\_INFO=64-bit target on x86-64 Linux $INFOTPVAL;  
set GNUATOMIC=-latomic;  
set GCCINC=/usr/lib/gcc/x86\_64-linux-gnu/13/include /usr/local/include /usr/include/x86\_64-linux-gnu /usr/include;  
set GPPDIR=/usr/include/c++/13 /usr/include/x86\_64-linux-gnu/c++/13 /usr/include/c++/13/backward /usr/lib/gcc/x86\_64-linux-gnu/13/include /usr/local/include /usr/include/x86\_64-linux-gnu /usr/include;  
set NUMALIBNAME=;  
set LOCALRC=YES;  
set EXTENSION=\__extension_\_=;  
set LC=-lgcc -lc $if(-Bstatic,-lgcc\_eh, -lgcc\_s);  
set DEFSTDOBJDIR=/usr/lib/x86\_64-linux-gnu;  
set DEFCUDAVERSION=12.6;  
set DEFSTDPARCOMPUTECAP=;  
# GLIBC version 2.39  
# GCC version 13.3.0  
set GCCVERSION=130300;  
export PGI=$COMPBASE;  
# makelocalrc executed by root 2025年 09月 11日 星期四 16:06:24 CST

Compared with the `localrc` I had on my previous machine, this one includes more variables. I’m wondering if I could simply modify the old machine’s `localrc` by hand to solve the problem.

---

<div class="post-metadata">

**Author:** ![MatColgrove](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/matcolgrove/32/14047_2.png) [@MatColgrove](https://forums.developer.nvidia.com/u/MatColgrove)\
**Post date:** [September 11, 2025, 4:23pm UTC](https://forums.developer.nvidia.com/t/nvhpc-25-1-nvc-cannot-find-iostream/344548/6 "2025-09-11T16:23:53Z")

</div>

Odd, all the GNU variable with the directory information is coming up blank. The script queries gcc and g++ to get this information. So I suspect that there’s something off with your gcc install, possibly you’re missing the GNU development package?

What’s the output from the command: “gcc -E -Wp,-v -x c foo.c”?

`I’m wondering if I could simply modify the old machine’s `localrc` by hand to solve the problem.`

You can, though if there is a missing install for GNU, then you’ll likely have other issues.

---

<div class="post-metadata">

**Author:** ![lth112347](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@lth112347](https://forums.developer.nvidia.com/u/lth112347)\
**Post date:** [September 12, 2025, 2:26am UTC](https://forums.developer.nvidia.com/t/nvhpc-25-1-nvc-cannot-find-iostream/344548/7 "2025-09-12T02:26:01Z")

</div>

Thanks!

This it the comtent of the foo.c:  
# include \<stdio.h\>

int main(void) {  
printf(“Hello, world!\n”);  
return 0;  
}  
I ran the command and get the following result:  
[foo.txt](https://forums.developer.nvidia.com/uploads/short-url/krPr5x9jfASPbnS1tfohFSb3E0h.txt) (15.2 KB)  
I tried `yum reinstall gcc` and then reinstalled `nvhpc`, but I found the result was the same.  
Then I tried this command:

```bash
/public/software/compiler/nvhpc_sdk_test/Linux_x86_64/25.1/compilers/bin/makelocalrc \
  -x /public/software/compiler/nvhpc_sdk_test/Linux_x86_64/25.1/compilers/bin \
  -gcc gcc -gpp g++

```

However, the contents of the localrc file didn’t change at all, although the program exited normally.

I also tried using other versions of gcc and g++, but the effect was the same.

May I ask, apart from manually modifying localrc, is there any other method available?

---

<div class="post-metadata">

**Author:** ![tcu](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@tcu](https://forums.developer.nvidia.com/u/tcu)\
**Post date:** [September 14, 2025, 6:26pm UTC](https://forums.developer.nvidia.com/t/nvhpc-25-1-nvc-cannot-find-iostream/344548/8 "2025-09-14T18:26:23Z")

</div>

> [@lth112347](#):
>
> [root@admin 4090]# module load compiler/nvhpc/25.1

I noticed this command. Is this a site-local setup of some kind? I just add the modulefiles directory and I see

`---------------------------- /opt/nvidia/hpc_sdk/modulefiles -----------------------------`  
`nvhpc-byo-compiler/25.7 nvhpc-hpcx-cuda12/25.7 nvhpc-nompi/25.7`  
`nvhpc-hpcx-2.20-cuda12/25.7 nvhpc-hpcx/25.7 nvhpc/25.7`

Oh, and doing this as root is not a good idea (to echo Mat’s comment)

---

<div class="post-metadata">

**Author:** ![MatColgrove](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/matcolgrove/32/14047_2.png) [@MatColgrove](https://forums.developer.nvidia.com/u/MatColgrove)\
**Post date:** [September 15, 2025, 7:38pm UTC](https://forums.developer.nvidia.com/t/nvhpc-25-1-nvc-cannot-find-iostream/344548/9 "2025-09-15T19:38:43Z")

</div>

> [@lth112347](#):
>
> May I ask, apart from manually modifying localrc, is there any other method available?

Until we know what the problem is, I don’t have another solution.

When you ran the command “gcc -E -Wp,-v -x c foo.c”, what was printed to stderr?

I can’t quite tell if nothing printed, or you just omitted posting it.

It should have shown the search path for the include files, something like:

```auto
% gcc -E -Wp,-v -x c foo.c > foo1.txt
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/11/include-fixed"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/11/../../../../x86_64-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-redhat-linux/11/include
 /usr/local/include
 /usr/include
End of search list.

```

```auto
% gcc -E -Wp,-v foo.cpp > foo1.txt
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/11/include-fixed"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/11/../../../../x86_64-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-redhat-linux/11/../../../../include/c++/11
 /usr/lib/gcc/x86_64-redhat-linux/11/../../../../include/c++/11/x86_64-redhat-linux
 /usr/lib/gcc/x86_64-redhat-linux/11/../../../../include/c++/11/backward
 /usr/lib/gcc/x86_64-redhat-linux/11/include
 /usr/local/include
 /usr/include
End of search list.

```

Also, I noticed in the output you provided, several non-printable characters:

```auto
# 1 "foo.c"
# 1 "<built-in>"
# 1 "<å‘½ä»¤è¡Œ>"
# 31 "<å‘½ä»¤è¡Œ>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 32 "<å‘½ä»¤è¡Œ>" 2

```

These correspond to “\<command-line\>”, which just indicates that the compile was issued from the command line, so may not matter, but I’m wondering if the locale might have something to do with it.

What’s the output from the command “locale”?

---

<div class="post-metadata">

**Author:** ![lth112347](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@lth112347](https://forums.developer.nvidia.com/u/lth112347)\
**Post date:** [September 18, 2025, 8:57am UTC](https://forums.developer.nvidia.com/t/nvhpc-25-1-nvc-cannot-find-iostream/344548/10 "2025-09-18T08:57:28Z")

</div>

Thanks — here are the exact outputs you asked for.  
`gcc -E -Wp,-v -x c foo.c` (stderr):  
[c\_stderr.txt](https://forums.developer.nvidia.com/uploads/short-url/9B4QaHSBV2E3vBe4Ugu9fSzFGuD.txt) (1.4 KB)  
`gcc -E -Wp,-v foo.cpp` (stderr):  
[cpp\_stderr.txt](https://forums.developer.nvidia.com/uploads/short-url/mEWY9NVtQexYWq8FuSfvaBQjVSA.txt) (1.6 KB)  
`locale`:  
[locale.txt](https://forums.developer.nvidia.com/uploads/short-url/pdqZhkVfgCQXFGmgGVX06080Wip.txt) (330 Bytes)  
Really appreciate your guidance — this helps me a lot!

---

<div class="post-metadata">

**Author:** ![MatColgrove](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/matcolgrove/32/14047_2.png) [@MatColgrove](https://forums.developer.nvidia.com/u/MatColgrove)\
**Post date:** [September 18, 2025, 4:28pm UTC](https://forums.developer.nvidia.com/t/nvhpc-25-1-nvc-cannot-find-iostream/344548/11 "2025-09-18T16:28:44Z")

</div>

You’re locale is “en\_US.UTF-8” so that’s fine, I just can’t explain the odd characters (I guessed that the may be Chinese characters), but it may have just been a copy and paste thing.

Now in the output you are getting some extra include directories which aren’t default, presumably you have these added to you’re environments CPATH, C\_INCLUDE\_PATH, and/or CPLUS\_INCLUDE\_PATH variables. Though when I try doing the same, the localrc file is still correct.

I’m out of ideas so let me ask some other folks.

---

<div class="post-metadata">

**Author:** ![MatColgrove](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/matcolgrove/32/14047_2.png) [@MatColgrove](https://forums.developer.nvidia.com/u/MatColgrove)\
**Post date:** [September 18, 2025, 5:39pm UTC](https://forums.developer.nvidia.com/t/nvhpc-25-1-nvc-cannot-find-iostream/344548/12 "2025-09-18T17:39:20Z")

</div>

They would like to see the debug output from makelocalrc. Can you run the following commands and post the full output?

```auto
bash -x makelocalrc -n -gcc /usr/bin/gcc -gpp /usr/bin/g++
bash -x makelocalrc -n

```

---

<div class="post-metadata">

**Author:** ![lth112347](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@lth112347](https://forums.developer.nvidia.com/u/lth112347)\
**Post date:** [September 19, 2025, 1:56am UTC](https://forums.developer.nvidia.com/t/nvhpc-25-1-nvc-cannot-find-iostream/344548/13 "2025-09-19T01:56:42Z")

</div>

Thank you very much for your guidance!  
My server was compromised earlier, so I reinstalled the system. After that I ran the command you suggested and here are the outputs: [output1.txt](https://forums.developer.nvidia.com/uploads/short-url/1YmkyoLlSQxsQKMkVWNFqGY2nhR.txt) (57.8 KB) and [output2.txt](https://forums.developer.nvidia.com/uploads/short-url/nO08V4veyXIbmacs03PoKUQnxCn.txt) (28.2 KB).

I also tried running the command `makelocalrc -x /public/software/compiler/nvhpc_sdk/Linux_x86_64/25.1/compilers/bin -gcc gcc -gpp g++`again, and I noticed that the file  
`/public/software/compiler/nvhpc_sdk/Linux_x86_64/25.1/compilers/bin/localrc`  
has indeed been updated. The contents now look like this:

```auto
set LFC=-lgfortran;
set LDSO=/lib64/ld-linux-x86-64.so.2;
set GCCDIR=/usr/lib/gcc/x86_64-redhat-linux/8/;
set G77DIR=/usr/lib/gcc/x86_64-redhat-linux/8/;
set OEM_INFO=64-bit target on x86-64 Linux $INFOTPVAL;
set GNUATOMIC=;
set GCCINC=/usr/lib/gcc/x86_64-redhat-linux/8/include /usr/local/include /usr/include;
set GPPDIR=/usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8 /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/x86_64-redhat-linux /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/backward /usr/lib/gcc/x86_64-redhat-linux/8/include /usr/local/include /usr/include;
set NUMALIBNAME=-lnuma;
set LOCALRC=YES;
set EXTENSION= __extension__ =;
set LC=-lgcc -lc $if(-Bstatic,-lgcc_eh, -lgcc_s);
set DEFCUDAVERSION=12.6;
set DEFSTDPARCOMPUTECAP=;
# GLIBC version 2.28
# GCC version 8.5.0
set GCCVERSION=80500;
set LIBNCURSES=YES;
export PGI=$COMPBASE;
# makelocalrc executed by root Thu Sep 18 21:48:08 EDT 2025

```

This time it looks normal, and I was able to successfully compile a simple “Hello World” with `nvc++`.  
Thanks again for your help! I really appreciate the time you spent on this.

**Wishing the NVIDIA HPC SDK project continued success — and thank you once more for your kind support!**

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/system/32/68080_2.png) [@system](https://forums.developer.nvidia.com/u/system)\
**Post date:** [October 3, 2025, 1:57am UTC](https://forums.developer.nvidia.com/t/nvhpc-25-1-nvc-cannot-find-iostream/344548/14 "2025-10-03T01:57:13Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
