LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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-04-2011, 02:13 AM   #1
p.heidary
LQ Newbie
 
Registered: Mar 2010
Posts: 9

Rep: Reputation: 0
Unhappy have problem with gfortran linker!


Hi guys;
I have received the following error massage
"linker input file unused because linking not done"
while compiling and linking the include file anal.inc
so edited the file just like:
" program abc
end"
that I am sure it can't have any error
and again I received the above massage
but when I have changed the suffix to .f instead of .inc every thing is ok ,
So would you please guide me how can I use such include file ?
I am working on some program calling COHERENS.

Last edited by p.heidary; 05-04-2011 at 02:16 AM.
 
Old 05-04-2011, 10:22 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
I'm not sure what you're trying to do but:

1. A .inc file is usually not a compilation unit.
You should use the .f extension instead.

2. A .inc file is for "including".
Use the "include" directive in one or more of your .f compilation units:
Code:
include 'anal.inc'
3. Here is more information on the "include" directive:
http://gcc.gnu.org/onlinedocs/gcc-3....7/INCLUDE.html
 
1 members found this post helpful.
Old 05-07-2011, 04:55 AM   #3
p.heidary
LQ Newbie
 
Registered: Mar 2010
Posts: 9

Original Poster
Rep: Reputation: 0
thank you
but I am running the software throat GNUMakeFile that has been developed by MUMM (Management Unit of the Mathematical Models of the North Sea)
and face with that kind of error .
so when I have traced it found that the following code gives error and the required fills didn't produce.
.............................................................
#
# Makefile for the COHERENS model
#
# Author - Patrick Luyten
#
# Last Update - 6 May 1998 @{COHERENS}Makefile 8.4
#
# Description -
#
# The lines where VPATH and IFLAGS are defined should be deleted if
# the macro VPATH is not provided by the 'make' utility and/or the
# program application has been installed with the startup file
# 'csetup'. If the startup file 'vsetup' has been used, these two
# lines should be retained. (The directories SOURCE and PROJECT are
# defined by executing vsetup or csetup).
#
# Additional (machine dependent) compiler options (e.g. to produce
# optimised code) can be selected with FOPT.
#
# FC must be set to the compiling command for FORTRAN programs, which
# is assumed to be 'f77' in the present version. If the appropriate
# command on the user's machine has a different name, replace 'f77' on
# the right hand side of FC by the appropriate command name.
#
# Executing 'make' performs the following:
# - each module is compiled separately (except 'preproc.f' and 'defmod.f')
# without linking
# - the object files are linked to produce the executable program
# 'coherens'
# - the files 'preproc.f' and 'defmod.f' are compiled without linking
# - all object files are linked to produce the executable program
# 'preproc'
#
# The name of the preprocessor or main program can be changed by assigning
# new values to PRECOM or MAINCOM.

#VPATH = PROJECT:SOURCE
#IFLAGS = -I. -IPROJECT -ISOURCE

#FOPT = -fast
FC = f77

# sourcefiles, target name

MAINFILES = mainprog.o preproc.o

OFILES1 = Intp_in.o Upwnd_in.o biolgy_in.o veddy_in.o

OFILES2 = advdis.o analys.o bcsin.o biolgy.o boundc.o bstres.o contny.o crrnt2.o crrnt3.o defanal.o defavr.o defout.o defpar.o densty.o dissip.o hadvdis.o heat.o heddy.o inicon.o initc.o integr.o mass.o metin.o outpa.o outpt.o print.o salt.o sedeul.o sedlag.o thomv.o tkleng.o tleng.o transh.o transp.o transv.o turben.o veddy.o wavin.o Dates.o Errors.o Inout.o Util.o

OFILES = $(OFILES1) $(OFILES2)

IFILES = anal.inc biopar.inc bounds.inc concn.inc consts.inc count.inc crrnts.inc depths.inc elev.inc errorv.inc grid.inc met.inc optics.inc out.inc param.inc partur.inc phycon.inc plnktn.inc runp.inc sedmnt.inc sedpar.inc stress.inc tavout.inc tide.inc time.inc tsout.inc turbke.inc turcon.inc visc.inc waves.inc worksp.inc

PRECOM = preproc
MAINCOM = coherens

# programs for which executable code will be created

all: $(MAINCOM) $(PRECOM)
@echo COHERENS binaries up-to-date

# remove unnecessary files

clean:
rm *.o *.O *.fil $(PRECOM) $(MAINCOM)

## creating executable code
# main program

$(MAINCOM): mainprog.o $(OFILES)
$(FC) $(FOPT) -o $(MAINCOM) mainprog.o $(OFILES)

# pre-processor

$(PRECOM): preproc.o defmod.o $(OFILES)
$(FC) $(FOPT) -o $(PRECOM) preproc.o defmod.o $(OFILES)

$(OFILES) $(MAINFILES) defmod.o: $(IFILES)
$(FC) $(FOPT) $(IFLAGS) -c $<
........................................................

and the last one that contains .inc files will produce error

Can you tell what it the problem , please!
 
Old 05-07-2011, 01:55 PM   #4
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

Sorry things still aren't working for you . Here's where we're at:

1. The error message in your original post, "linker input file unused because linking not done"
while compiling and linking the include file anal.inc suggests that you were trying to compile and/or link an include file. You can't do that .

2. The Makefile you posted in your second post looks OK - it tries to compile source files, it tries to link object files, and it checks dependencies on include files. It's doing "all the right things" .

SUGGESTION:
1. Re-copy your original source to a new directory.

2. Please tell us any "pre-build" steps you need to take (for example, if you run "configure" or have to edit the makefile).

3. Try building it again:
Quote:
make
4. Please post back the results. Cut/paste the EXACT error/warning message. Please be sure to post the FIRST error/warning message.

5. See if you get the binary executables "preproc" and "coherens".
If you do, try running them.
Perhaps the "error" you asked about was actually just a warning - maybe everything is already working.

Please let us know, one way or the other!

Good luck .. PSM
 
  


Reply



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
problem in installing gcc-gfortran 4.3.3 Kilam orez Linux - Newbie 12 06-29-2011 01:20 AM
Problem installing GFortran on RHEL5 with x86 hippster Red Hat 4 01-20-2011 08:32 AM
Problem to Read Binary File with gfortran kdurgarao Programming 1 10-12-2009 02:26 AM
[SOLVED] cryptic linker error (i really dont like linker errors); smeezekitty Programming 2 09-19-2009 02:21 AM
gfortran compiling problem, RHEL 4 The_Watcher Linux - Enterprise 1 08-22-2008 11:57 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration