[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #KRJ-634869]: NetCDF C++ build error



Hi,

Sorry this reply hgas taken so long, we were at the AMS meeting all
last week.

In your Makefile, you have:

INC = /store/home/prabhakar/Desktop/netcdf/include
LIB = /store/home/prabhakar/Desktop/netcdf/lib -lnetcdf -lnetcdf_c++

ReadT2: ReadT2.o
        g++ -o ReadT2 ReadT2.o

ReadT2.o: ReadT2.cpp
        g++ -c -I$(INC) -L$(LIB) ReadT2.cpp

but you need the libraries specified on the link line instead of the
compiler line:


ReadT2: ReadT2.o
        g++ -o ReadT2 ReadT2.o -L$(LIB)

ReadT2.o: ReadT2.cpp
        g++ -c -I$(INC) ReadT2.cpp

Also, it would be more conventional to incorporate the "-L" into the
LIB macro definition instead, such as:

INC = -I/store/home/prabhakar/Desktop/netcdf/include
LIBS = -L/store/home/prabhakar/Desktop/netcdf/lib -lnetcdf -lnetcdf_c++

ReadT2: ReadT2.o
        g++ -o ReadT2 ReadT2.o $(LIBS)

ReadT2.o: ReadT2.cpp
        g++ -c $(INC) ReadT2.cpp

but that's just cosmetic, the other version should work as well.

--Russ



Russ Rew                                         UCAR Unidata Program
address@hidden                     http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: KRJ-634869
Department: Support netCDF
Priority: Normal
Status: Closed