Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Xueyab

macrumors newbie
Original poster
Jul 30, 2019
1
0
Hi all,

I am compiling a model written by FORTRAN language. When I make, there are some errors:

gfortran -fopenmp -fbounds-check -o Noah ../Noah_code/module_Noahlsm.o ../Noah_code/module_Noahlsm_param_init.o ../Noah_code/module_Noahlsm_utility.o ../Noah_code/module_date_utilities.o ../IO_code/module_Noah_NC_output.o ../IO_code/module_Noahlsm_gridded_input.o ../IO_code/Noah_driver.o -L/usr/local/Cellar/netcdf/4.6.3_1/lib -lnetcdff
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[1]: [Noah] Error 1 (ignored)

This is my macro file:

1 .IGNORE:
2 RM = rm -f
3 COMPILER90= gfortran -fopenmp -fbounds-check
4 FREESOURCE= -ffree-form
5 F90FLAGS = -c -I/usr/local/Cellar/netcdf/4.6.3_1/include
6 MODFLAG =
7 LDFLAGS = -O3
8 CPP = cpp
9 CPPFLAGS = -C -P -traditional
10 RM = rm -f
11 RM = rm -f
12 RM = rm -f
13 RM = rm -f
14 RM = rm -f

And there is the main Makefile:

1 # Makefile
2 #
3 #INCLUDES=
4 .SUFFIXES:
5 .SUFFIXES: .o .f
6
7 include ../macros
8
9 MAINOBJ1 = ../IO_code/Noah_driver.o
10
11 OBJS = \
12 ../Noah_code/module_Noahlsm.o \
13 ../Noah_code/module_Noahlsm_param_init.o \
14 ../Noah_code/module_Noahlsm_utility.o \
15 ../Noah_code/module_date_utilities.o \
16 ../IO_code/module_Noah_NC_output.o \
17 ../IO_code/module_Noahlsm_gridded_input.o
18
19 CMD = Noah
20 all: $(CMD)
21
22 Noah: $(OBJS) $(MAINOBJ1)
23 @echo ""
24 $(COMPILER90) -o $(@) $(OBJS) $(MAINOBJ1) -L/usr/local/Cellar/netcdf/4.6.3_1/lib -lnetcdff
25 @echo ""
26
27 # This command cleans up
28
29 clean:
30 rm ../IO_code/*mod ../IO_code/*.o
31 rm ../Noah_code/*mod ../Noah_code/*.o
32 rm $(CMD)

This model only needs NetCDF. I just brew install netcdf.

Any ideas? Thanks in advance!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.