- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
On Sun UNIX, I used to be able to call a fortran routine from C main routine. In detail,
----- C routine: test2_f_land_2.c
void main(){
int f_land_2_();
printf(%c", f_land_2_(&lat, &lon) );
---- Fortrain subroutine
integer function f_land_2(lat,long)
But when I ported the codes to Tru64 Unix, and compile it as
test2 : test2.o f_land_2.o
$(CC) test2.o f_land_2.o $(LIBS) -o test2
I get an error:
cc -I./ -I~sk/tp/prog/libraries/headers -g -c test2_f_land_2.c
f77 test2_f_land_2.o f_land_2.o -lm -o test2_f_land_2
ld:
/usr/lib/cmplrs/fort90/for_main.o: main: multiply defined
Unresolved:
MAIN__
f77: Severe: Failed while trying to link.
*** Exit 1
Stop.
Can anyone suggest how I can properly link? I tried f90 & f95 - no luck
Thanks
----- C routine: test2_f_land_2.c
void main(){
int f_land_2_();
printf(%c", f_land_2_(&lat, &lon) );
---- Fortrain subroutine
integer function f_land_2(lat,long)
But when I ported the codes to Tru64 Unix, and compile it as
test2 : test2.o f_land_2.o
$(CC) test2.o f_land_2.o $(LIBS) -o test2
I get an error:
cc -I./ -I~sk/tp/prog/libraries/headers -g -c test2_f_land_2.c
f77 test2_f_land_2.o f_land_2.o -lm -o test2_f_land_2
ld:
/usr/lib/cmplrs/fort90/for_main.o: main: multiply defined
Unresolved:
MAIN__
f77: Severe: Failed while trying to link.
*** Exit 1
Stop.
Can anyone suggest how I can properly link? I tried f90 & f95 - no luck
Thanks
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try adding -noformain to the f77 command when you link.
Steve
Steve

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page