Re: WRAPIT error

From: <brownrig_at_nyahnyahspammersnyahnyah>
Date: Fri May 17 2013 - 13:44:56 MDT

Hi,

As Dennis pointed out, there's a conflict with a variable named "i" in
your fortran code with one that gets generated in the C wrapper. To
see this, run "WRAPIT -d kmeans_cluster.f" and this will leave a file
WRAPIT.c, the wrapper code, in the directory.

More to the point, I'm not certain, but it appears WRAPIT *always*
generates that "int i;" declaration in the C code, even if its not
used (this seems like a bug to me --- a variable name "i" is
invariably going to collide with fortran code somewhere). In your
case, it doesn't appear to be used.

I see two work-arounds:

1. Rename the variable i in the fortran code. This looks mildly
painful, as its referenced in a number of places.

2. Follow the directions at the link for manually compiling/linking
your library, editing the C code after step 2 to remove the spurious
"int i;":

    http://ncl.ucar.edu/Document/Manuals/Ref_Manual/NclExtend.shtml#wrapit77

Maybe someone else knows a better way, but I hope this helps.

Rick

On Fri, 17 May 2013 15:26:09 +0800
  Prince K XAVIER <prince.xavier@gmail.com> wrote:
> All,
>
> I am trying to do a WRAPIT on the attached code, but it fails with :
>
> WRAPIT Version: 120209
> WRAPIT.c: In function ‘clustr_W’:
> WRAPIT.c:29:7: error: conflicting types for ‘i’
> WRAPIT.c:22:6: note: previous declaration of ‘i’ was here
> COMPILING kmeans_cluster.f
> LINKING
> gcc: error: WRAPIT.o: No such file or directory
> rm: cannot remove `WRAPIT.o': No such file or directory
> END WRAPITkmeans_cluster.f"
>
> These are not really very useful error messages, but if anyone has a
>clue
> on what I am doing wrong that will be useful to know. I'm using
>gfortran
> and NCL 6.1.2.
>
> Thanks in advance,
> Prince

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri May 17 13:45:06 2013

This archive was generated by hypermail 2.1.8 : Thu May 30 2013 - 11:38:10 MDT