View previous topic :: View next topic |
Author |
Message |
Fonya
Joined: 08 Jun 2009 Posts: 3
|
Posted: Mon Jun 08, 2009 7:01 pm Post subject: Linking codes |
|
|
Hi all,
I'm new to fortran and have a problem linking the main program to sub routines. Program calls many subroutines that in turn call up other subroutines. I get a runtime error for the very first one "Error 29, Call to a missing routine ..." when I try to execute. First I paste the errors and further below is the somewhat lengthy program!
Please help out!
Fonya
WARNING the following symbols are missing:
JULIAN_DAY C:\thinclouds\retrieval\src\lgotemp@.obj
(C:\THINCLOUDS\RETRIEVAL\
Last edited by Fonya on Wed Jun 10, 2009 2:50 pm; edited 1 time in total |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2554 Location: Sydney
|
Posted: Tue Jun 09, 2009 7:39 am Post subject: |
|
|
you need to use slink to link all the .obj files, or have one .f file.
for example
if you have the files
mainasc.f
sub1.f
sub2.f
you need the commands and text input
ftn95 main asc.f
ftn95 sub1.f
ftn95 sub2.f
slink
lo mainasc.obj
lo sub1.obj
lo sub2.obj
file mainasc.exe
Alternatively you could have the source file "all.f" consisting only of
include 'mainasc.f'
include 'sub1.f'
include 'sub2.f'
then compile and link or compile and go with
ftn95 all.f /link
ftn95 all.f /lgo
You should read help on slink, as the slink commands can be put into a text file of commands.
My solution is for operating in a dos (cmd.exe) box. If you want to use PLATO then someone else can help. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7927 Location: Salford, UK
|
Posted: Tue Jun 09, 2009 9:31 am Post subject: |
|
|
The alternative is to put your files into a project using an IDE like Plato or Visual Studio then the IDE will sort out the linking for you. |
|
Back to top |
|
|
Fonya
Joined: 08 Jun 2009 Posts: 3
|
Posted: Thu Jun 18, 2009 11:08 pm Post subject: |
|
|
Great! I use slink to link all the .obj files. I can now create my .exe even though it won't run because of NETCDF. Thank you!
Does the compiler have NETCDF libraries? How do establish the link to NETCDF lib?
Fonya |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7927 Location: Salford, UK
|
Posted: Fri Jun 19, 2009 8:41 am Post subject: |
|
|
I have had a quick look at the Unidata website and it looks like you have the following basic options.
1. Use a existing library written in Fortran.
2. Use a existing library written in C/C++.
3. Download the Fortran source code and compile using FTN95.
4. Download the C/C++ source code and compile using SCC.
The main thing to be aware of is the most third party libraries use the STDCALL protocol but by default FTN95 and SCC do not. This means that options 3 and 4 may prove easier in the long run.
Have a look in the FTN95 help file searcing for STDCALL. Also note the compiler switch /IMPORT_LIB. |
|
Back to top |
|
|
|