iwold |
12/07/2006 06:26AM (Read 8470 times)
|
|
|
Status: offline
Registered: 09/28/2006
Posts: 9
|
Dear Mike,Thank you for all your help. I am trying to compile a fortran task named photstand.f I am attempting to follow procedures laid out in previous forum topics with no success. This is what I have done:[code:1:c0f39aee2d]csh
>setenv iraf /iraf/iraf/
>setenv IRAFARCH cygwin
>source $iraf/unix/hlib/irafuser.csh[/code:1:c0f39aee2d]I then start IRAF and go to the /bin directory which contains photstand.f
[code:1:c0f39aee2d]cl>fc photstand.f[/code:1:c0f39aee2d]This is what the error looks like:photstand.f:
MAIN:
Error on line 156 of photstand.f: nonarithmetic operand of arithmetic operator
Error on line 157 (same as line above)
Error on line 158 (same as line above)
Error on line 159 (same as line above)
Error on line 160 (same as line above)
/iraf/iraf/unix/hlib/f77.sh: line 179: gcc: command not foundAny help would be greatly appreciated.Isak
|
|
|
|
fitz |
12/07/2006 06:26AM
|
|
|
Status: offline
Registered: 09/30/2005
Posts: 4040
|
Hi Isak,I'd have to see the code to be sure, but the first error (nonarithmetic ....) is usually a type conflict of some kind, e.g. use of a boolean variable in an equation.
Otherwise, it appears you'll need to install GCC from the cygwin distribution even after than is solved, you can do this with the cygwin setup under the Developer tools. If all you need is a binary and arent developing the task actively feel free to send it to me and I'll try compiling it and posting the result.Cheers,
-Mike
|
|
|
|
iwold |
12/07/2006 06:26AM
|
|
|
Status: offline
Registered: 09/28/2006
Posts: 9
|
Thank you Mike,I have installed gcc and believe that problem is taken care of. However the nonarth. errors remain. The program has been provided to me to assist in photometry. It is currently in use on other systems. So I believe that it is a working code, just not on my system. The lines that are giving me the nonarithmetic error are of the form:
[code:1:30b7770e0d] l1 = (file(4:4) - 48) * 10000[/code:1:30b7770e0d]
I believe the compilier is expecting 'file(4:4)' to be a number. Any suggestions would be greatly appreciated.Isak
|
|
|
|
fitz |
12/07/2006 06:26AM
|
|
|
Status: offline
Registered: 09/30/2005
Posts: 4040
|
Either an atoi() function or the use of a temporary variable should do it, e.g.[code:1:f0f6dc65f0]l1 = (atoi(file(4:4))- 48) * 10000
or
i1 = file(4:4)
l1 = (i1 - 48) * 10000[/code:1:f0f6dc65f0]-Mike
|
|
|
|
iwold |
12/07/2006 06:26AM
|
|
|
Status: offline
Registered: 09/28/2006
Posts: 9
|
Thank you Mike,Using the atoi function seems the most promising, however still not successful. Here is the output:[code:1:6815895e51]ecl> fc photstand.f
MAIN:
link:
photstand.o:photstand.c:(.text+0xac5): undefined reference to '_atoi_'
photstand.o:photstand.c:(.text+0x143c): undefined reference to '_fit_'
(multiple occurances not shown)
collect2: ld returned 1 exit status
[/code:1:6815895e51]I am thinking that the proper fortran flag may define atoi and fit but I have been unable to find it.Use of a temporary variable results in an error which states: impossible conversion.I have also tried to compile this program outside of iraf using the following command copied from the program's code header information:[code:1:6815895e51]$ f77 -o photstand photstand.f -lpress[/code:1:6815895e51]But this results in an error stating: Invalid form for WRITE statement, which points to the following line:
write(unit=7,*) x(i),y(i),sig(i)
....................^
Any help would be greatly appreciated. Thank you for your time.Isak
|
|
|
|
fitz |
12/07/2006 06:26AM
|
|
|
Status: offline
Registered: 09/30/2005
Posts: 4040
|
Maybe I only imagined that atoi() was a fortran function, in any case I just checked and using[code:1:bd0a7e5d8d]i1 = int (file(4:4))[/code:1:bd0a7e5d8d] should work as expected and compile properly. As for the write statement: You might try putting quotes around the *, but it actually compiles for me as is.-Mike
|
|
|
|
iwold |
12/07/2006 06:26AM
|
|
|
Status: offline
Registered: 09/28/2006
Posts: 9
|
Thank you Mike for going above and beyond,The int() function works! And I have found that the undefined reference to fit, is a subroutine that is required for the photstand program. I have obtained the fit subroutine but have not been able to compile due to this error:
[code:1:cc072073a2]ecl> fc fit.f
fit.f:
fit:
link:
/iraf/iraf/unix/bin.cygwin/libf2c.a(main.o):(.text=0x18c): undefined reference to '_MAIN__'
collect2: ld returned 1 exit status[/code:1:cc072073a2]If you have any suggestions please feel free to make them at your leisure. Thank you.Isak
|
|
|
|
fitz |
12/07/2006 06:26AM
|
|
|
Status: offline
Registered: 09/30/2005
Posts: 4040
|
Isak,Use "fc -c fit.f" to compile just the object file you include when compiling your program, or else compile both programs together at the same time, e.g. [code:1:521bba3120]cl> fc photstand.f fit.f -o photstand.e[/code:1:521bba3120]At the moment it appears to be trying to compile fit.f as a standalone program, but the file is missing a 'program' statement.-Mike
|
|
|
|
iwold |
12/07/2006 06:26AM
|
|
|
Status: offline
Registered: 09/28/2006
Posts: 9
|
Success!!Thank you very much.Isak
|
|
|
|