Compiling C++ code with NetCDF libraries: "undefined reference"

Hi!

I am trying to compile a C++ code with cmake and gcc on Ubuntu. The code uses NetCDF4 libraries. I specify the path to these libraries as follows:

-I/usr/local/include -L/usr/local/lib -lnetcdf -lnetcdf_c++4

"ccmake" and "cmake" work fine. After typing "make" I receive the error message:

Linking CXX executable guess
CMakeFiles/guess.dir/modules/guessio_daily_netCDF.cpp.o: In function `getYearlyRecord(Coord, double*, xtring, int)':
guessio_daily_netCDF.cpp:(.text+0x8309): undefined reference to `netCDF::NcFile::NcFile(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, netCDF::NcFile::FileMode)'
(...)

I receive the same message when I specify the path to my NetCDF4 libraries with a not-existing path (e.g. -I/blablabla/include ...). As I understand, the linker does not find my NetCDF libraries, correct? Do you have any suggestions on how to solve this problem? In case it helps, below I include the paths of all my netcdf libraries. The libraries were built with the same compiler (gcc). Thank you very much in advance!

Cheers,
Chris

/usr/share/man/man3/netcdf.3.gz
/usr/share/man/man3/netcdf_f77.3.gz
/usr/share/man/man3/netcdf_f90.3f90.gz
/usr/share/doc/netcdf-bin
/usr/share/doc/libnetcdf-dev
/usr/share/doc/libnetcdf6
/usr/share/mime/application/x-netcdf.xml
/usr/lib/libnetcdf_c++.so
/usr/lib/libnetcdff.so
/usr/lib/libnetcdf.a
/usr/lib/netcdf.pc
/usr/lib/pkgconfig/netcdf.pc
/usr/lib/libnetcdf.so.6.0.0
/usr/lib/libnetcdff.so.5.0.0
/usr/lib/libnetcdf.so.6
/usr/lib/libnetcdf_c++.so.5
/usr/lib/libnetcdf.so
/usr/lib/libnetcdf_c++.a
/usr/lib/libnetcdff.so.5
/usr/lib/libnetcdff.a
/usr/lib/libnetcdf_c++.so.5.0.0
/usr/include/netcdf.mod
/usr/include/netcdf.h
/usr/include/hdf/hdf2netcdf.h
/usr/include/hdf/hdf4_netcdf.h
/usr/include/netcdf.hh
/usr/include/netcdf.inc
/usr/include/netcdfcpp.h
/usr/local/lib/libnetcdf_c++4.la
/usr/local/lib/pkgconfig/netcdf-cxx4.pc
/usr/local/lib/libnetcdf_c++4.so
/usr/local/lib/libnetcdf_c++4.so.1.0.2
/usr/local/lib/libnetcdf_c++4.a
/usr/local/lib/ncarg/data/cdf/sst30e_netcdf.nc
/usr/local/lib/ncarg/data/cdf/sstdata_netcdf.nc
/usr/local/lib/libnetcdf_c++4.so.1
/usr/local/include/netcdf