# NVCC Problem with \_Float32

**URL:** <https://forums.developer.nvidia.com/t/nvcc-problem-with-float32/177692>\
**Category:** nvc, nvc++ and nvfortran\
**Created:** [May 11, 2021, 5:56pm UTC](https://forums.developer.nvidia.com/t/nvcc-problem-with-float32/177692 "2021-05-11T17:56:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikostul](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/mikostul/32/463498_2.png) [@mikostul](https://forums.developer.nvidia.com/u/mikostul)\
**Post date:** [May 11, 2021, 5:56pm UTC](https://forums.developer.nvidia.com/t/nvcc-problem-with-float32/177692/1 "2021-05-11T17:56:38Z")

</div>

I am trying to make a C code and keep getting the following errors:

```
/opt/nvidia/hpc_sdk/Linux_x86_64/2020/cuda/bin/nvcc -c -O3 -I/opt/nvidia/hpc_sdk/Linux_x86_64/2020/cuda/include -I/opt/nvidia/hpc_sdk/Linux_x86_64/2020/math_libs/include lusol_cusparse.c
In file included from /usr/include/stdlib.h:55:0,
                 from /opt/nvidia/hpc_sdk/Linux_x86_64/21.3/compilers/include/stdlib.h:13,
                 from lusol_cusparse.c:1:
/opt/nvidia/hpc_sdk/Linux_x86_64/21.3/compilers/include/bits/floatn.h:60:17: error: two or more data types in declaration specifiers
   typedef float _Float32;
                 ^ ~~~~~~~
/opt/nvidia/hpc_sdk/Linux_x86_64/21.3/compilers/include/bits/floatn.h:63:18: error: two or more data types in declaration specifiers
   typedef double _Float64;
                  ^ ~~~~~~~
/opt/nvidia/hpc_sdk/Linux_x86_64/21.3/compilers/include/bits/floatn.h:74:18: error: two or more data types in declaration specifiers
   typedef double _Float32x;
                  ^ ~~~~~~~~
/opt/nvidia/hpc_sdk/Linux_x86_64/21.3/compilers/include/bits/floatn.h:78:25: error: two or more data types in declaration specifiers
     typedef long double _Float64x;
                         ^ ~~~~~~~~
Makefile:56: recipe for target 'lusol_cusparse.o' failed

```

I am not sure if this is an error with the gcc version I have or something else since it seems gcc 7+ has \_Float32 as a compiler built-in.

I am not sure what I am missing.

Miko

- Predictive Science Inc. Intern

---

<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:** [May 11, 2021, 7:39pm UTC](https://forums.developer.nvidia.com/t/nvcc-problem-with-float32/177692/2 "2021-05-11T19:39:40Z")

</div>

Hi Miko,

I’m a bit confused by the question since you say this is a problem with CUDA Fortran but you’re using nvcc to compile a C program. For CUDA Fortran you’d want to use nvfortran and a Fortran source file.

The actual error is that gcc is trying to use the header files we ship with the NVHPC SDK but these should only be used with nvc or nvc++. gcc should use the system header files.

nvcc itself wouldn’t implicitly add “/opt/nvidia/hpc\_sdk/Linux\_x86\_64/21.3/compilers/include/” to the search path and I don’t see you adding it via the “-I” flag so it’s unclear why gcc is searching this directory.

Are you setting “C\_INCLUDE\_PATH” in your environment to include “/opt/nvidia/hpc\_sdk/Linux\_x86\_64/21.3/compilers/include/”? If so, please remove this directory from the environment variable so gcc will use the correct headers.

By the way, the -I directories you are using, shouldn’t exist (unless you’ve made links), and nvcc would implicitly include the proper directories so aren’t needed anyway.

-Mat

---

<div class="post-metadata">

**Author:** ![mikostul](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/mikostul/32/463498_2.png) [@mikostul](https://forums.developer.nvidia.com/u/mikostul)\
**Post date:** [May 11, 2021, 7:59pm UTC](https://forums.developer.nvidia.com/t/nvcc-problem-with-float32/177692/3 "2021-05-11T19:59:31Z")

</div>

> [@MatColgrove](#):
>
> Are you setting “C\_INCLUDE\_PATH” in your environment to include “/opt/nvidia/hpc\_sdk/Linux\_x86\_64/21.3/compilers/include/”? If so, please remove this directory from the environment variable so gcc will use the correct headers.

That was the problem! Thank you for the help. Sorry for the confusion caused by my title.

---

<div class="post-metadata">

**Author:** ![caplanr](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/caplanr/32/21701_2.png) [@caplanr](https://forums.developer.nvidia.com/u/caplanr)\
**Post date:** [May 12, 2021, 1:05am UTC](https://forums.developer.nvidia.com/t/nvcc-problem-with-float32/177692/4 "2021-05-12T01:05:47Z")

</div>

Hi Mat,

The CPATH is pre-pended in the NV HPC SDK module file as:

`$nvcompdir=$nvhome/$target/$version/compilers`  
`export CPATH=$nvcompdir/include:$CPATH `

This was causing the conflict even though we were using the NVCC that came with the HPC SDK.  
Commenting this out solved the problem.  
Why does the NVCC that comes with the HPC SDK use GCC instead of NVC?

- Ron

---

<div class="post-metadata">

**Author:** ![TomNVIDIA](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/tomnvidia/32/14181_2.png) [@TomNVIDIA](https://forums.developer.nvidia.com/u/TomNVIDIA)\
**Post date:** [October 12, 2021, 4:06pm UTC](https://forums.developer.nvidia.com/t/nvcc-problem-with-float32/177692/5 "2021-10-12T16:06:45Z")

</div>

Closed on October 12, 2021, 4:06pm UTC


