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

[netCDF #LFX-930679]: Unusual "undefined reference to" errors using



Hi Andrew,

I think the problem is your definition of CFLAGS in the Makefile as:

  LIBDIR=-L/usr/lib -L/usr/lib/mysql -L/usr/local/lib
  CFLAGS=-g -w -Wall $(LIBDIR) $(INCDIR)

The reason this causes a problem is that it puts all the compiler options
referring to the libraries before the compiler flags mentioning the object
files, and only libraries appearing after the object files are actually
searched for unsatisfied externals.

To check this, you could try manually running the command that's producing the
error messages:

  g++ -g -w -Wall -L/usr/lib -L/usr/lib/mysql -L/usr/local/lib -I.
  -I/usr/include -I/usr/include/mysql++ -I/usr/include/mysql
  -I/usr/local/include/opencx -I/usr/local/include/cart -lm -lz -largtable2
  -lmysqlclient -lmysqlpp -lgd -lfreetype -lpng -ljpeg -lgsl -lgslcblas
  -lnetcdf -lnetcdf_c++ alphamap.o common.o csvparser.o databaseinterface.o
  datahandler.o interpolator.o mod_csv.o mod_esri.o mod_flt.o mod_quicksat.o
  mod_voyage.o preprocess.o scanner.o cluster.o -o preprocess

by reordering the arguments as follows and see if the unsatisfied external
error messages go away:

  g++ -g -w -Wall -I. -I/usr/include -I/usr/include/mysql++
  -I/usr/include/mysql -I/usr/local/include/opencx -I/usr/local/include/cart
  alphamap.o common.o csvparser.o databaseinterface.o datahandler.o
  interpolator.o mod_csv.o mod_esri.o mod_flt.o mod_quicksat.o mod_voyage.o
  preprocess.o scanner.o cluster.o -o preprocess  -L/usr/lib -L/usr/lib/mysql
  -L/usr/local/lib -lm -lz -largtable2 -lmysqlclient -lmysqlpp -lgd -lfreetype
  -lpng -ljpeg -lgsl -lgslcblas -lnetcdf -lnetcdf_c++

So maybe just changing your make rule will fix the problem, something like:

preprocess: $(PREPROCESS_DEPS) cluster.o
  $(CC) $(CFLAGS) $(PREPROCESS_DEPS) cluster.o -o preprocess $(PREPROCESS_LIBS)

--Russ


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



Ticket Details
===================
Ticket ID: LFX-930679
Department: Support netCDF
Priority: Normal
Status: Closed