Compilation problem with gfortran


 
Thread Tools Search this Thread
Top Forums Programming Compilation problem with gfortran
# 8  
Old 08-01-2011
Hi.

For the iargc problem, remove or comment out the line:
Code:
integer, external :: iargc

cheers, drl
This User Gave Thanks to drl For This Post:
# 9  
Old 08-01-2011
Ok the iargc error disappeared. But I still have the following errors:

Code:
[greg@Uranus:~/WRF/WPS/data/SRTM_conversion]$ make
gfortran -c -ffree-form -O -fconvert=big-endian -frecord-marker=4 rd_wr_formatted.f90
gfortran  -o rd_wr_formatted.exe rd_wr_formatted.o read_geogrid.o write_geogrid.o
rd_wr_formatted.o: In function `MAIN__':
rd_wr_formatted.f90:(.text+0x639): undefined reference to `write_geogrid_'
collect2: ld returned 1 exit status
make: *** [rd_wr_formatted.exe] Error

# 10  
Old 08-01-2011
Hi.

Please post results from:
Code:
nm write_geogrid.o

cheers, drl
# 11  
Old 08-01-2011
Results:

Code:
[greg@Uranus:~/WRF/WPS/data/SRTM_conversion]$ nm write_geogrid.o
         U __stack_chk_fail
         U __strncpy_chk
         U fclose
         U fopen
         U free
         U fwrite
         U malloc
00000000 T write_geogrid

# 12  
Old 08-01-2011
Hi.

You can see now that Fortran compiles the external link name as:
Code:
undefined reference to `write_geogrid_'

but gcc is compiling the name as:
Code:
00000000 T write_geogrid

You can try adding the underscore to the name in the c code, but I'm guessing that that you will need to work on the binding relationship that is the Fortran-95 standard. That will also affect how memory items are thought to be arranged between Fortran and c.

But try changing the name in the c code first to see what that does ... cheers, drl
# 13  
Old 08-02-2011
Ok I add a '_' to the write_geogrid in the c code. Now the compilation seems ok because there is no errors. But when I'm executing I have this error:

Code:
[greg@Uranus:~/WRF/WPS/data/SRTM_conversion]$ ./rd_wr_formatted.exe srtm_35_05.asc
At line 66 of file rd_wr_formatted.f90 (unit = 10, file = 'srtm_35_05.asc')
Fortran runtime error: Bad value during floating point read

# 14  
Old 08-02-2011
Hi.

Are you sure that the data file has 12,001 data items on a line? (I think that's what that means.)
Code:
33    format(f6.1, 12000f7.1)

if so, nx and ny at 1200 seem less than necessary.

Otherwise, what is the intention?

In any case, for debugging a program until you feel it is correct, I suggest that you use compiler-supplied tests, such as -fbounds-check -- see man gfortran for details ... cheers, drl

---------- Post updated at 16:36 ---------- Previous update was at 09:09 ----------

Hi.

In looking over your program again, and with writing a small test case, I think the format 33 with 12000f7.1 is probably OK, provided that there are enough legitimate values to satisfy 1200 values for 1200 lines. Your write statement inside the reading loop will probably print nx+1 for i because it was recently used in the implicit loop.

I think that means we need to look at a sample of the real data file. I was able to obtain this error message:
Code:
At line 15 of file three.f90 (unit = 10, file = 'data1')
Fortran runtime error: Bad value during floating point read

I got this by damaging a value in my data file, from "7" to "x":
Code:
   1.0   2.0   3.0   4.0   5.0   6.0
   7.0   8.0   9.0  10.0  11.0  12.0

to:
Code:
   1.0   2.0   3.0   4.0   5.0   6.0
   x.0   8.0   9.0  10.0  11.0  12.0

Consequently, there is likely something in your file that does not conform to the format ... cheers, drl
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

GFORTRAN library problem: libgFORTRAN.so.1 cannot open....

I've received some executable script for test, but executing this script continuously give me following message ./example: error while loading shared libraries: libgfortran.so.1: cannot open shared object file: No such file or directory Google search told me to do as following $... (1 Reply)
Discussion started by: exsonic
1 Replies

2. Programming

problem compiling with gfortran in two different debian releases

Hello, I hope this is the correct forum for this post. I have the following problem: A Fortran 77 program that has to deal with several large matrices (each approx. 5000 x 5000) and uses lapack and blas subroutines has been correctly compiled and executed using Debian Etch. When I tried... (1 Reply)
Discussion started by: currix
1 Replies

3. Programming

gfortran compiling problem,calling too many arguments

Hello, My problem is with compiling a program modelling shallow water. In it there is a subroutine called stat with 9 parameters. In the main program it is called with 9 parameters also I'm running Ubuntu 11.04 with gfortran version 4.5. Thanks. ---------- Post updated at 11:57 PM... (0 Replies)
Discussion started by: b_franz
0 Replies

4. AIX

Problem in compilation.

Hi, I am executing the below mentioned code:- proc SQLCHECK=SEMANTICS iname=CDBInteractor.pc parse=none code=cpp cpp_suffix=cpp g++ -c main.cpp g++ -o pre_request_engine main.o -I/oracle/oracle/app/product/10g/precomp -L/oracle/oracle/app/product/10g/lib32 -lnsl -ldl And... (2 Replies)
Discussion started by: tushar_tus
2 Replies

5. Programming

C Compilation problem

Dear all I am new to C programming In response to the post cat get_time.c #include <stdlib.h> #include <sys/time.h> main() { struct timeval tv; struct timezone tz; struct tm *tm; gettimeofday(&tv, &tz); tm=localtime(&tv.tv_sec); printf("... (2 Replies)
Discussion started by: on9west
2 Replies

6. AIX

Compilation problem

hi, I first want to apologize for my poor english ! I'm a newbe on Unix system and I have to install NRPE on an AIX 5.3. I have downloaded the NRPE Source code and i need to compile them... the problem is, when I do a: ./configure --enable-command-args --disable-ssl it returns me :... (1 Reply)
Discussion started by: Cyr1us
1 Replies

7. AIX

Pro C Compilation problem

Hi, I have AIX 5.3 and my code is written in proc . i am getting following error during compilation Please help?////..... :-d: Compiling with RMS cc -w -q32 -qidirfirst -ISource/Header -I/usr/vacpp/include -q32 -DRMS -DDISEC -DDBG -DBIGENDIAN -DBIT32 -c -q32... (0 Replies)
Discussion started by: ajaysahoo
0 Replies

8. Programming

Compilation problem on HP-UX

Hi, Environment : HP-UX avalon B.11.11 U 9000/800 3547052374 unlimited-user license aCC version :aCC: HP ANSI C++ B3910B A.03.37 I need to find a way out of this errors.can anyone help me . $ aCC db.cc -I$ORACLE_HOME/rdbms/public -I/disk1/oracle/product/10.2.0.2/* Error (future)... (1 Reply)
Discussion started by: varuntayur
1 Replies

9. Programming

compilation problem

i have a class name 1.c in tht i am using function n wich has his body in 2.c and declaration in 2.h now how can i compile 1.c. ex; 1.c int main() { //some data n(10); //somedata } ***** 2.c int n(int k) { //some data } int main() { some data (2 Replies)
Discussion started by: phani_sree
2 Replies

10. Solaris

compilation problem

I am compiling a software named wine When i run make then at the end following error generated. DVAPI32_ -foversion.res version.rc ld.so.1: ../../tools/wrc/wrc: fatal: relocation error: file ../../tools/wrc/wrc: symbol wine_casemap_upper: referenced symbol not found *** Signal 9 make:... (0 Replies)
Discussion started by: mansoorulhaq
0 Replies
Login or Register to Ask a Question