Hi,
I tried to compile the attached code which is a module to be used with grass. My question is how to get the compiler to know my grass gis libraries? In other words what is the correct syntax to add my local gis libraries to the compiler in the make file?
I am running Mac 10.5.4 with GRASS 6.4 and gcc compiler.
Here is my make file:
PGM = rat
CC = gcc
OBJECTS = \
main.o \
log.o
GISBASE = /Applications/GRASS-6.4.app/Contents/MacOS/include
GISLIB = /Applications/GRASS-6.4.app/Contents/MacOS/lib
XDRLIB = /Users/bubbasgrill/Downloads/grass-6.4.svn_src_snapshot_2009_04_18/lib
$(PGM): $(OBJECTS)
$(CC) $(OBJECTS) -L$(GISLIB) -L$(XDRLIB) -o $(PGM)
main.o:
$(CC) -I$(GISBASE) -c main.c
log.o:
$(CC) -I$(GISBASE) -c log.c
and here what I got from terminal:
~/Downloads/g2w/AverageTables_Unix >make
gcc -I/Applications/GRASS-6.4.app/Contents/MacOS/include -c main.c
gcc -I/Applications/GRASS-6.4.app/Contents/MacOS/include -c log.c
gcc main.o log.o -L/Applications/GRASS-6.4.app/Contents/MacOS/lib -L/Users/bubbasgrill/Downloads/grass-6.4.svn_src_snapshot_2009_04_18/lib -o rat
Undefined symbols:
“_G_trim_decimal”, referenced from:
_main in main.o
“_G_parser”, referenced from:
_main in main.o
“_G_find_cell”, referenced from:
_main in main.o
“_G_define_flag”, referenced from:
_main in main.o
_main in main.o
_main in main.o
“_G_define_option”, referenced from:
_main in main.o
_main in main.o
_main in main.o
“_G__gisinit”, referenced from:
_main in main.o
“_G_get_cat”, referenced from:
_main in main.o
“_G_area_of_cell_at_row”, referenced from:
_main in main.o
“_G_tempfile”, referenced from:
_main in main.o
_main in main.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [rat] Error 1
I appreciate your help since this is my first time to add module to grass and also I am new to makefile techniques…
Best,
Ibrahim
–
IBRAHIM N. MOHAMMED
Utah State University
Research Assistant
Civil & Environmental Engineering
Utah Water Research Laboratory
Utah State University
Logan, UT. 84322-4110
Tel: (435) 797-3533
Email: Ibrahim.mohammed@aggiemail.usu.edu
(attachments)
Archive.zip (7.22 KB)