NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Hi Namu For the record, I am not a C++ programmer. This is all I can do to help. On CentOS 7.5, with the same libraries as you, I get the same errors. It looks like libnetcdf_c++ is the legacy/obsolete version. 'yum info' shows this: Description : Legacy netCDF C++ library. This library is provided for backward : compatibility only. New C++ development should be done with the netCDF : CXX4 C++ library. See also this: https://www.unidata.ucar.edu/support/help/MailArchives/netcdf/msg12530.html But unfortunately that is the one available in Red Hat/CentOS 7. The new interface is libnetcdf_c++4.You point to it in your compilation command, but you don't have that library installed.
Unfortunately I couldn't find the libnetcdf_c++4 for RedHat/CentOS 7 on epel, which is too bad.However, on Fedora Core 26, with libnetcdf.so.11.0.4 and libnetcdf_c++4.so.1.0.3 the program compiles fine.
So, I guess this problem is really a matter of having only the obsolete libnetcdf_c++ library. I hope this helps, Gus Correa On 07/18/2018 04:34 PM, namu patel wrote:
On RedHat 7, using yum, I installed netCDF4 C and C++ libraries: $ ls /usr/lib64/*netcdf* /usr/lib64/libnetcdf_c++.so /usr/lib64/libnetcdf.so /usr/lib64/libnetcdf_c++.so.4 /usr/lib64/libnetcdf.so.7 /usr/lib64/libnetcdf_c++.so.4.2.0 /usr/lib64/libnetcdf.so.7.2.0 $ ls /usr/include/*netcdf* /usr/include/netcdfcpp.h /usr/include/netcdf.hh /usr/include/netcdf.h /usr/include/netcdf_meta.h I am trying to compile the code: #include <iostream> #include <netcdf> using namespace std; using namespace netCDF; int main() { return 0; } using: g++ -o test test.cpp -I/usr/include -L/usr/lib64 -lnetcdf_c++4 -lnetcdf -lm but get the error: fatal error: netcdf: No such file or directory #include <netcdf> ^ compilation terminated. I tried using netcdf.h and netcdfcpp.h. This gives me the error: error: ‘netCDF’ is not a namespace-name using namespace netCDF; error: expected namespace-name before ‘;’ token using namespace netCDF; I'll appreciate any help in trying to get this working. Thanks, Namu _______________________________________________ NOTE: All exchanges posted to Unidata maintained email lists are recorded in the Unidata inquiry tracking system and made publicly available through the web. Users who post to any of the lists we maintain are reminded to remove any personal information that they do not want to be made public. netcdfgroup mailing list netcdfgroup@xxxxxxxxxxxxxxxx For list information or to unsubscribe, visit: http://www.unidata.ucar.edu/mailing_lists/
netcdfgroup
archives: