Due to the current gap in continued funding from the U.S. National Science Foundation (NSF), the NSF Unidata Program Center has temporarily paused most operations. See NSF Unidata Pause in Most Operations for details.

[netcdfgroup] netcdf.h file not found in cLion

Dear group,

I am currently working on a project where I need to use the netcdf-c library. I 
use cLion as my code editor.

I installed netcdf-c, HDF5 and zlib according to this building manual: 
http://www.unidata.ucar.edu/software/netcdf/docs/getting_and_building_netcdf.html#build_default

Cmake is also installed for compiling c files in cLion.

In my CMakeLists I have the following:

cmake_minimum_required(VERSION 3.6)
project(hello)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror")
include_directories("/usr/local/netcdf4/include")
set(SOURCE_FILES main.c )
add_executable(hello ${SOURCE_FILES})

where I include this directory where "/usr/local/netcdf4/include" where netcdf 
is installed and the helper file should be present.

When I compile the file and make using make main, I get the following:

main.c:19:10: fatal error: 'netcdf.h' file not found
#include <netcdf.h>
         ^
1 error generated.
make: *** [main] Error 1

Do I need to add something extra to the CMakeLists?

Kind regards,

Moustafa


  • 2016 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: