If you post your makefiles for this particular program (or links to them), it might be easier to help.
I have two questions before we continue to try other things:
1. Did you try to repeat (in Ubuntu) the method that worked with fedora 2 .4.22 using gcc commands?
2. Did you try using the f2c/gcc combination according to this link?
http://valhalla.fcaglp.unlp.edu.ar/~computacion/Manuales/Online/flinux/index.html
I had some time to fix your program:
1. Declaration of character variables
2. Opening of file (not necessary, otherwise the program writes to the file fort.7)
3. Added a write statement to the terminal write(*,...)
And simply used
which compiled and linked a working program for meCode:gfortran -o prtime prtime.f
Code:C----------------------------------------------------------------------- C PR(INT) TIME C C PRINTS PRESENT DATE AND TIME AND GIVES IT IN A FORMAT SUITED FOR THE C RUNHEADER AND EVENTHEADER. C THIS SUBROUTINE IS CALLED FROM AAMAIN AND START. C ARGUMENT: C TTIME = TIME (YYMMDD) C C IF OUR DATE ROUTINE DOES NOT FIT TO YOUR COMPUTER, PLEASE REPLACE C IT BY A SUITABLE ROUTINE OF YOUR SYSTEM C FOR COMPILERS WITH NEWER DATE FUNCTIONS, INCLUDING DEC UNIX f77 C AND RECENT GNU g77 >0.5.21 (egcs 1.1.x, gcc 2.95, ...) C IF YOR COMPUTER DOES NOT KNOW SUBROUT. DATE_AND_TIME C REPLACE THIS CALL BY A CALL TO YOUR SYSTEM ROUTINES TO C FILL THE INTEGERS: IYEAR, MONTH, IDAY, IHOUR, IMINU, ISEC character*8 YYYYMMDD character*6 HHMMSS open(7,file="printed-time.txt") CALL DATE_AND_TIME( YYYYMMDD, HHMMSS ) READ(YYYYMMDD,'(I4,2I2)') IYEAR,MONTH,IDAY READ(HHMMSS,'(3I2)') IHOUR,IMINU,ISEC write(7,100) IDAY,MONTH,IYEAR,IHOUR,IMINU,ISEC write(*,100) IDAY,MONTH,IYEAR,IHOUR,IMINU,ISEC TTIME = MOD(IYEAR,100)*10000 + MONTH*100 + IDAY 100 FORMAT(' PRESENT TIME : ',I2.2,'.',I2.2,'.',I4,I4.2,':',I2.2, * ':',I2.2) RETURN END
Last edited by sudodus; January 22nd, 2013 at 11:06 PM. Reason: removing doublet text
Thank you so much for the time you spent on this.
but the problem seems to be unsolved.
first to your previous question I should say that I used gcc/f2c combination but that one also gives some errors like this:
and about your correction on the PRTIME subroutine I should say that this a only a small part of the program and this is not my program.Code:/tmp/fort77-29566-1.c:17864:12: error: conflicting types for ‘fctcos_’ /tmp/fort77-29566-1.c:17302:33: note: previous declaration of ‘fctcos_’ was here /tmp/fort77-29566-1.c:26703:22: error: conflicting types for ‘rtmi_’ /tmp/fort77-29566-1.c:17296:33: note: previous declaration of ‘rtmi_’ was here /usr/bin/f77: aborting compilation
this a scientific program for Simulating cosmic rays.
that one also comes with some errors:
Code:character*8 YYYYMMDD 1 Error: Symbol 'yyyymmdd' at (1) already has basic type of CHARACTER lateralf.f:19183.24: character*6 HHMMSS 1 Error: Symbol 'hhmmss' at (1) already has basic type of CHARACTER lateralf.f:35547.10:
here is the original file:
http://sdrv.ms/Xwz3il
and here is some snapshots of the program directory:
http://sdrv.ms/VRokm2
http://sdrv.ms/Uilgz3
also i mentioned earlier that I'm able to compile files with gcc just like fedora but when I try to link files it comes with some errors!
Last edited by msgeo; January 22nd, 2013 at 09:14 PM.
I see. That did not help
Probably you had some other compiler or linker version or a library available in Fedora, that you don't have (yet) in Ubuntu.
Well, I had only the snippet you posted, and I needed declarations of the character variables to make the compiler happy. Obviously there are some kind of include statements or global statements, that declare the character variables.and about your correction on the PRTIME subroutine I should say that this a only a small part of the program and this is not my program.
this a scientific program for Simulating cosmic rays.
that one also comes with some errors:
Code:character*8 YYYYMMDD 1 Error: Symbol 'yyyymmdd' at (1) already has basic type of CHARACTER lateralf.f:19183.24: character*6 HHMMSS 1 Error: Symbol 'hhmmss' at (1) already has basic type of CHARACTER lateralf.f:35547.10:
But I would like to know if you can create a working program of the fortran code in post #13 using the command line in the same post. That will show if your compiler and linker have enough 'horsepower' to do that (for example if there is such a time function or subroutine).
I am running Ubuntu 12.04 LTS 32-bit with pae
Code:uname -a Linux ssd-grund 3.2.0-36-generic-pae #57-Ubuntu SMP Tue Jan 8 22:01:06 UTC 2013 i686 i686 i386 GNU/LinuxI'll look at that later.
here is the original file:
http://sdrv.ms/Xwz3il
and here is some snapshots of the program directory:
http://sdrv.ms/VRokm2
http://sdrv.ms/Uilgz3
also i mentioned earlier that I'm able to compile files with gcc just like fedora but when I try to link files it comes with some errors!
The .o files are compiled object code files. It might be enough, but you might need some kind of reference to the linker or some libraries (if more than the default ones are needed).
This could be possible to see in one of the makefiles.
--
With the snippet in post #13 it was possible for me to compile to an object file with
and to link withCode:gfortran -c prtime.f
It created a file identical to the one created directly from the fortran source code file. So yes, it could be possible to link with the command you suggested, at least concerning the prtime subroutine.Code:gfortran -o prtime-from-o prtime.o
Last edited by sudodus; January 23rd, 2013 at 12:19 AM. Reason: concerning the prtime subroutine
I looked at it. Yes, I could see the whole time subroutine
with declaration of variables, that were not there in the snippet.Code:SUBROUTINE PRTIME( TTIME )
I also had a second look at the command line in post #1
I think you'd make the compiler/linker confused with the two -o options. First you tell it to write the final program to file1.o and then to outputfilename. The correct syntax should beCode:gfortran -o file1.o file2.o file3.o -o outputfilename
The command line in post #11 looks correct.Code:gfortran -o outputfilename file1.o file2.o file3.o
and I guess this is the real thingCode:gfortran -o cor69 lateralf.o qgsjet-II-03.o gheisha_2002d.o
If you still have problems, maybe you should check, if you have double definitions or calls to the time subroutine, that there is another one, that cannot be resolved.
What about this one?
These are not calls to or via PRTIMECode:INTEGER ILEFTA,ILEFTB,TIME EXTERNAL TIME ... C TIME AT BEGINNING ILEFTA = TIME() ... ... C TIME SINCE BEGINNING ILEFTB = TIME() TDIFF = ILEFTB - ILEFTA
I'm really grateful for your help...
this ""time"" function isn't really important but i don't know how to get rid of it!
just downloaded the fedora 18 to see if i can compile and link files on that
Then I think the problem is the call of
So you should make a function or subroutine instead of that to use the same time call as in PRTIME,Code:TIME()
or some other call to the system time that is supported, and use the output of that instead of the external TIME() call. You should also check what unit it is supposed to be (seconds?)Code:CALL DATE_AND_TIME( YYYYMMDD, HHMMSS )
Bookmarks