|
How to include files from other directories in a program?
Hi all,
I have a fortran 77 code that has a statement
include 'netcdf.inc'
The file 'netcdf.inc' is in another directory /Users/makwana/Desktop/CDF/include
When i compile this program I get:
KirirtMakwana:F77 makwana$ gfortran -c simple_xy_wr.f
Error: Can't open included file 'netcdf.inc'
Error: Can't open included file 'netcdf.inc'
I gave the full path to the file in the program as follows:
include '/Users/makwana/Desktop/CDF/include/netcdf.inc'
and then it compiles but gives the following error when linking:
KirirtMakwana:F77 makwana$ gfortran -o outs simple_xy_wr.o
Undefined symbols:
"_nf_def_dim_", referenced from:
_MAIN__ in simple_xy_wr.o
_MAIN__ in simple_xy_wr.o
"_nf_enddef_", referenced from:
_MAIN__ in simple_xy_wr.o
"_nf_create_", referenced from:
_MAIN__ in simple_xy_wr.o
"_nf_close_", referenced from:
_MAIN__ in simple_xy_wr.o
"_nf_put_var_int_", referenced from:
_MAIN__ in simple_xy_wr.o
"_nf_def_var_", referenced from:
_MAIN__ in simple_xy_wr.o
"_nf_strerror_", referenced from:
_handle_err_ in simple_xy_wr.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
I want to know how to specify the full path of 'netcdf.inc' to the program from the command line?
Thanks,
Kirit.
|