LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2005-02-18 09:26:01


Without seeing the full set of your source code and how you're
including files and whatnot, it's impossible to say for sure. An
educated guess is that your typedef for Kstruct is somehow not
appearing before you try to instantiate masterKstruct, or, similar to
your previous problem, perhaps you've got executable C code before your
instantiations, which is forbidden in C.

Based on your later errors regarding baseaddress, I'm guessing it's the
latter -- so none of your variables are being instantiated, and
therefore become "undeclared" later in the function. But again -- it's
hard (impossible) to say for sure by only looking at a snipit of your
code.

That being said, these look like basic C compilation issues, not really
having to do with LAM, MPI, or parallel computing. Forgive me for
being blunt, but this is not really within the scope of this mailing
list. I would strongly prefer if we kept on-topic -- discussing LAM
and/or MPI issues, not generic C compilation problems that are
unrelated to parallel programming. You might want to consult a C
reference book or have a chat with some local C programming wizards.

Thanks!

On Feb 18, 2005, at 7:46 AM, karlos Tbone wrote:

> Ok, Thanks Ricky, you were dead right there, changed it around, this
> is the problem with building it up in a modular fashion working on
> bits at a time...
>
> so now unfortunately there's plenty more problems!
>
> compiling now gives:
>
> mpitest2.c: In function `main':
> mpitest2.c:213: parse error before `masterKstruct'
> mpitest2.c:221: `masterKstruct' undeclared (first use in this function)
> mpitest2.c:221: (Each undeclared identifier is reported only once
> mpitest2.c:221: for each function it appears in.)
> mpitest2.c:221: `baseaddress' undeclared (first use in this function)
> mpitest2.c:222: warning: passing arg 2 of `MPI_Address' from
> incompatible pointer type
> mpitest2.c:223: warning: assignment makes integer from pointer without
> a cast
> mpitest2.c:224: warning: passing arg 2 of `MPI_Address' from
> incompatible pointer type
> mpitest2.c:225: warning: assignment makes integer from pointer without
> a cast
> mpitest2.c:226: warning: passing arg 2 of `MPI_Address' from
> incompatible pointer type
> mpitest2.c:227: warning: assignment makes integer from pointer without
> a cast
> mpitest2.c:229: `MPI_Kstruct' undeclared (first use in this function)
> mpitest2.c:229: warning: passing arg 3 of `MPI_Type_struct' from
> incompatible pointer type
> mpitest2.c:229: warning: passing arg 4 of `MPI_Type_struct' from
> incompatible pointer type
>
> I declared the three arrays to be:
>
> int lena[3];
> int loca[3];
> int typa[3];
>
> I'm wondering why I should have the first error:
>
> `masterKstruct' undeclared (first use in this function)
>
> as it seems to me that it is declared properly.
>
> The Second type of error:
>
> mpitest2.c:221: `baseaddress' undeclared (first use in this function)
>
> Isn't baseaddress declared properly at:
>
> MPI_Aint baseaddress;
>
> With my last error, what is a correct way of casting?
>
> mpitest2.c:222: warning: passing arg 2 of `MPI_Address' from
> incompatible pointer type
> mpitest2.c:223: warning: assignment makes integer from pointer without
> a cast
>
> Many Thanks
>
>
>
> On Fri, 18 Feb 2005 20:21:03 +0800, Ricky Tang Siu Hong
> <shtang_at_[hidden]> wrote:
>>> ....
>>>
>>> When I try to compile this program I get the following error:
>>>
>>> mpitest2.c:234: parse error before `status'
>>>
>>>
>>> Could anyone tell me where I'm going wrong with this?
>>>
>>
>> Maybe I am wrong... Is it require to put declaration in front of any
>> code?
>> Let's say, MPI_Status before MPI_Address(...)
>>
>>
> _______________________________________________
> This list is archived at http://www.lam-mpi.org/MailArchives/lam/
>

-- 
{+} Jeff Squyres
{+} jsquyres_at_[hidden]
{+} http://www.lam-mpi.org/