I have a c++ project that I am trying to re-organize. I am trying to subdivide the src directory to move some src files that seldom are changed to a more out of the way location. The project is a c++ application with a fortran function called from the c.
The reorganization went fine, until I got to the fortran src file. I have two fortran complie rules for the src directory.
What I tried to do was to add a driectory to ./src, ./src/src_main/ and move some or the fortran src files into that directory. I added a compile rule for the new subdirectory,
I am getting an error that there is no rule to make the fortran objects. This same method worked fine to move some cpp src files to a different sub directory. I am guessing this is an issue with the fortran includes (COMMON etc), but I would have expected the fortran to fail with a compiler error, not the linker to fail because the object never go compiled. Is there some off the wall syntax to this or something?
Question 2:
I have a little logic that tries to determine which fortran is installed.
Which gfortran returns /usr/bin/gfortran, but I am getting g77 as FCOMP. I must have made an error in the above, but I can't see it.
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 2,288
Thanks Given: 430
Thanked 480 Times in 395 Posts
Hi.
Question 2:
You are testing HAVEgfortran in the second if sequence which will then (re)set FCOMP. I suggest making the first endif an else, and add another endif, say on a file "m2":
Then:
Thanks, that fixes the second question. I was sure it was something obvious, but I find limited value in staring at code forever when I can't see what's wrong.
It just says that there is no rule to make the required object.
Quote:
Originally Posted by drl
Hi.
There are no TABS in the rules you posted ... cheers, drl
I checked, and there is definitely a tab there to start the second line. I am not counting the lines with the continue characters. The src file compiles fine when it is in src/, with the same rule, but when I move the src file to src/src_Main/ and add a rule for src/src_Main/, the object doesn't get created.
The cpp files in that folder get compiled, it is just the Fortran that are being skipped.
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 2,288
Thanks Given: 430
Thanked 480 Times in 395 Posts
Hi.
Let us step back a minute.
Quote:
Originally Posted by LMHmedchem
... I am getting an error that there is no rule to make the fortran objects. This same method worked fine to move some cpp src files to a different sub directory. I am guessing this is an issue with the fortran includes (COMMON etc), but I would have expected the fortran to fail with a compiler error, not the linker to fail because the object never go compiled ...
If make thinks there is no rule, then the compiler would not get called, and so there could not be an error in compilation. If there is no compilation, then I would expect the linker to complain.
Could you explain more about "same method worked fine to move some cpp src files" -- are you saying that the makefile causes files to be moved? Or that you moved them and that a makefile for cpp worked correctly?
Do you have cpp and fortran source in the same directory, and have a single makefile for both the cpp and fortran codes?
Please post the exact error message that you get -- copy and paste so you get all the characters.
The version of make you are using would also be useful.
Hello
I am working on a CPP code written for SUN CC 5.5
and make
we used make to compile the code then it compilation went smooth
now i am using gmake:
I have a make file like this
WSROOT=..
include $(WSROOT)/etc/wsmkinclude.common
all:
@for subdir in */Makefile; \
do \... (1 Reply)
Hello
I am working on a CPP code written for SUN CC 5.5
and make
we used make to compile the code then it compilation went smooth
now i am using gmake:
I have a make file like this
WSROOT=..
include $(WSROOT)/etc/wsmkinclude.common
all:
@for subdir in */Makefile; \
do \... (1 Reply)
I have code that works fine in ifort. But when trying to run on gfortran 4.7.1 (which does support quads and has no problem with real * 16) I can't cast an integer variable to a quad precision float (real*16) using something like:
factq(i) = factq(i-1) * qfloat(i)
Finding a list of the new... (2 Replies)
Hello everyone,
I'm trying since a few days to compile a f90 program with gfortran (on Ubuntu) with a makefile. The fortran program calls 2 routines written in C.
Here is my makefile:
FC = gfortran
SFC = gfortran
FFLAGS = -ffree-form -O... (21 Replies)
I am a INTEL fortran user recently migrated to linux and installed gfortran on my system.
I run numerical models as part of my research.
my question is on optimization of the fortran code.
I used the - vectorize option to compile for reducing the run time considerably and was happy. But... (1 Reply)
Hi,
I am trying to run a simple f77 program on gfortran. Program is as follows.
program trial
implicit real*8 (a-h,o-z)
common/var/a(2),b,c(4),d
a=(/0,0/)
b=0
c=(/0,0,0,0/)
d=0
call add(a,b,c,d)
... (1 Reply)
Hi !
I have one program made of several sub programs which I am trying to compile with gfortran on Fedora 14 in my system. The program was originally written in Fortran 77 and compilation command used to be -
fort77 -O2 -f -w -o life life_com.f lifetime.f minuit.f tek_life.f utilities.f... (0 Replies)
Hi!
I have a program in fortran77. This program was compiled with pgf90, but now, I need compiled it with gfortran.
I show a bit of code.
program hello
PARAMETER(a=100)
integer a
write(*,*)'value ', a
end program hello
What's the problem?
Thanks (2 Replies)
How I can get the current make-file name in a make-file
So, if I run make with specified file:make -f target.mak
is it possible to have the 'target' inside of the that 'target.mak' from the file name? (2 Replies)
Hi,
i am trying to install AMBER10 which is a molecular dynamcis package onto two linux red hat pcs. I can successfully install the tools that comes with which uses gcc to compile, however AMBER10 requires either g95 or gfortran to compile. This is where the issue lies, i have installed both... (0 Replies)