bkaiser
bkaiser

Reputation: 657

Error during RNNLib configuration: netcdfcpp.h cannot be found

When attempting to compile RNNLib, I got an error in NetcdfDataset.hpp:26:24 saying that Netcdfcpp.h could not be found. I looked around and found a bug report from 2011 that suggested that this was a bug, but it claimed to have been fixed. I have tried everything I can think of, including rebuilding NetCDF (a dependency of RNNLib) with various different flags, and have been unable to fix this bug. Can anyone give me a hand?

Upvotes: 2

Views: 2851

Answers (5)

H. Rev.
H. Rev.

Reputation: 562

Maybe this helps someone: you can avoid some of the pain by installing packages from APT, and access the correct version mentioned by user3620756, which contains the netcdfcpp.h header file . This happens through a legacy package, available on Ubuntun 16.04 (Xenial universe, see APT repository).

First install libnetcdf for C, then install libnetcdf-cxx-legacy-dev which should depend on libnetcdf-c++4 and install required C++ libraries on the go:

sudo apt install libnetcdf-dev libnetcdf-cxx-legacy-dev

Upvotes: 3

jimjamslam
jimjamslam

Reputation: 2067

I had this problem in the context of trying to use a makefile that called for netcdfcpp.h:

$ make -f makefile_MAC
c++ -O2 -o burn7.x burn7.cpp -I/opt/local/include -L/opt/local/lib -lm -lnetcdf_c++
burn7.cpp:31:10: fatal error: 'netcdfcpp.h' file not found
#include <netcdfcpp.h>
     ^
1 error generated.
make: *** [burn7.x] Error 1

I'm on a Mac, so I used Homewbrew to install the NetCDF package, but version 4.3.3.1 didn't appear to have netcdfcpp.h:

brew install homebrew/science/netcdf

However, I found that installing it with an additional flag resulted in this version being included:

brew install homebrew/science/netcdf --with-cxx-compat

I assume that the same is true of other installation/compilation methods, and not that this file has been taken out of versions since 4.2 as others answers state. Maybe it was a default option before and now it isn't?

Upvotes: 0

Tanmoy Mondal
Tanmoy Mondal

Reputation: 449

I have also followed the same process and it worked for me "The newest version doesn't have this netcdfcpp.h file anymore. I had to use ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-cxx-4.2.tar.gz to get it working." After downloading the folder, I had to build it by entering into the netcdf folder. I used simple command for the task : .\configure make sudo make install

But in the file named as "NetcdfDataset.hpp", I have to give the complete path of the netcdfcpp.h file. For my case the path of the include file is :

#include "/Volumes/Macintosh_HD_2/WordSpottingProj/trunk/CODE C++/rnnlib_source_forge_version/netcdf-cxx-4.2/cxx/netcdfcpp.h"

Upvotes: 0

user3620756
user3620756

Reputation: 11

The newest version doesn't have this netcdfcpp.h file anymore. I had to use ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-cxx-4.2.tar.gz to get it working.

Upvotes: 1

Luc Mioulet
Luc Mioulet

Reputation: 123

I had some trouble on a virtual machine building rnnlib. I had to install the C and C++ version of NetCDF to get it to work.

The C version can be installed via sudo apt-get install libnetcdf-dev

I had to install the C++ version by building it.

Hope it will help. It's quite a difficult lib to install.

Upvotes: 4

Related Questions