LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Problem linking f77 and f90 object files Make problem (I think) (https://www.linuxquestions.org/questions/programming-9/problem-linking-f77-and-f90-object-files-make-problem-i-think-446023/)

TheBrick 05-18-2006 07:07 AM

Problem linking f77 and f90 object files Make problem (I think)
 
Hello all,

I am reposting this thread ad I had it posted in the general questions because I did not see this forum, sorry.

I am working on a machine with slackwear linux and gcc 3.4.6. I have been modifying and writing some fortran programs some written in f77 and others in f90. The computer did not have gfortran installed so I installed gcc 4.1 with the suffix -4.1 in my home directory. My program is written in f77 but a small amount of code (but enough that it is more than I really want to rewrite) that I have inherated is in f90. I thought if I compiled each part seperatly and then linked I should have a working program however I have some error that I do not understand. Please note I am NOT a programming master it may be very simple. Here is my output and make file below.


# Makefile for seedboxes code

FXX = g77
FXX2 = gfortran-4.1
FLAGS = -O
UFLAGS = -c
LIBPATH = -Wl,-rpath=/home/tommy/.kde/bin/gcc41/lib

#%.o: %.f
# $(FXX) $(UFLAGS) $<

SEEDBOXES: seedboxes.o tommysroutiens.o AZ_random_sub.o JFB_random_lowdensity_sub.o JFB_random_highdensity_sub.o
$(FXX2) $(FLAGS) $(LIBPATH) seedboxes.o tommysroutiens.o AZ_random_sub.o JFB_random_lowdensity_sub.o JFB_random_highdensity_sub.o -o SEEDBOXES.out
seedboxes.o: seedboxes.f tommysroutiens.f AZ_random_sub.f JFB_random_lowdensity_sub.f JFB_random_highdensity_sub.f
$(FXX) $(UFLAGS) seedboxes.f tommysroutiens.f AZ_random_sub.f JFB_random_lowdensity_sub.f
$(FXX2) $(UFLAGS) $(LIBPATH) JFB_random_highdensity_sub.f
tommysroutiens.o: tommysroutiens.f
$(FXX) $(UFLAGS) tommysroutiens.f
AZ_random_sub.o: AZ_random_sub.f
$(FXX) $(UFLAGS) AZ_random_sub.f
JFB_random_lowdensity_sub.o: JFB_random_lowdensity_sub.f
$(FXX) $(UFLAGS) JFB_random_lowdensity_sub.f
JFB_random_highdensity_sub.o: JFB_random_highdensity_sub.f
$(FXX2) $(UFLAGS) $(LIBPATH) JFB_random_highdensity_sub.f



clean:
rm -f *.o *~


g77 -c seedboxes.f tommysroutiens.f AZ_random_sub.f JFB_random_lowdensity_sub.f
gfortran-4.1 -c -Wl,-rpath=/home/tommy/.kde/bin/gcc41/lib JFB_random_highdensity_sub.f
gfortran-4.1 -O -Wl,-rpath=/home/tommy/.kde/bin/gcc41/lib seedboxes.o tommysroutiens.o AZ_random_sub.o JFB_random_lowdensity_sub.o JFB_random_highdensity_sub.o -o SEEDBOXES.out
seedboxes.o(.text+0x125): In function `MAIN__':
: undefined reference to `s_copy'
seedboxes.o(.text+0x13d): In function `MAIN__':
: undefined reference to `s_cmp'
.
.
.
.
.
.
.
JFB_random_lowdensity_sub.o(.text+0xba2): In function `insert_':
: undefined reference to `e_wsle'
collect2: ld returned 1 exit status
make: *** [SEEDBOXES] Error 1




I can supply the compleate output if it would help but it is .more of the same. Please be nice many Thanks.


T

P.S. I have since also tried compiling every thing with gfortran but this made no difference.

TheBrick 05-22-2006 06:17 AM

Just incase anyone is interested. I compiled everything with Gfortran but had to alter some intrisic function with in the f77 code such as lshift, rshift (with ishft) and time then every thing compiled and linked fine and dandy. Not sue how I would do it though if I had some c or c++ mixed with fortran and then had to link.


All times are GMT -5. The time now is 06:06 AM.