LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 05-18-2006, 07:07 AM   #1
TheBrick
Member
 
Registered: Mar 2006
Location: London
Distribution: SUSE 10.0 Home soon to go (no internet conection), gentoo laptop, slack on development box
Posts: 81

Rep: Reputation: 15
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.
 
Old 05-22-2006, 06:17 AM   #2
TheBrick
Member
 
Registered: Mar 2006
Location: London
Distribution: SUSE 10.0 Home soon to go (no internet conection), gentoo laptop, slack on development box
Posts: 81

Original Poster
Rep: Reputation: 15
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Make Trouble linking some fortran code Make file problem? any ideas? TheBrick Linux - General 0 05-17-2006 11:21 AM
f77 compiling problem ekosis Linux - Software 2 05-09-2006 04:18 PM
Object linking order causes Segmentation fault??? The_Nerd Programming 1 11-03-2005 11:26 PM
Object file problem in C Josh328 Programming 2 10-31-2004 12:57 PM
BitTorrent problem; unsubscriptable object? jeopardy Linux - Software 1 09-22-2004 12:06 PM


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

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration