swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Have you ever seen a compiler error message like this?


From: Paul Johnson
Subject: Re: Have you ever seen a compiler error message like this?
Date: Thu, 6 Nov 1997 23:38:44 -0600 (CST)

Scott C. wins the prize. I had a typo in Makefile so Setter.o was
not being created.  In case you deleted the previous mail, you can
read below to see what a linker error is.

Interestingly, after I fixed that problem,
I got a similar run-time error because of a different typo. 
Where I should have had "list", a thing defined in my code,
instead I had "List", which is a Swarm-word, and so it compiled,
but crashed when running with an error "List.any does not
respond to Creates."  Very interesting. I'm seeing all kinds of
ways to screw up.

Here is the newest way.  I've created a typedef called "dimarray", 
which at the moment is just an array with two integers, but in the
future may be more.  It represents a point in a two dimensional space.
 It works fine in most of the code, except when it comes to
passing values back to a program. I want an actor, the "Setter", to take 
some input--current position--and output a proposed new position.  Here
is a little example of the kind of method I'd like to write:

---------------Setter.m-------

#import "Setter.h"
#import <simtools.h>
#import "Voter.h"
#import "CountHeads.h"
#import "dimarray.h"

@implementation Setter

-(dimarray)makeProp: (dimarray) x {
 
 newpos[0]= x[0] + 1;  //this would be embellished once I understood
  newpos[1]= x[1] + 1; //the passing of values.     
 return newpos;}

-------------------------end of snippit------------------

Obviously, I've not found the right way to pass an array back out
of a method because this is the compiler/linker error message:

Setter.m:53: `_i_Setter__makeProp_' declared as function returning an array
Setter.m: In function `_i_Setter__makeProp_':
Setter.m:53: warning: conflicting types for `-(dimarray)makeProp:(dimarray)x'
Setter.h:23: warning: previous declaration of `-(dimarray)makeProp:(dimarray)x'
Setter.m:57: warning: return makes integer from pointer without a cast


Well, if you've got any patience left, tell me how to look at this.
I've been studying a big fat C manual along with the Next book.  I've
got a basic understanding of pass by reference and pass by value.  They
way I see it, I ought to be able to pass an array by reference, but
the compiler won't cooperate.



On Thu, 6 Nov 1997, Scott Christley wrote:

> At 12:01 AM 11/6/97 -0600, Paul Johnson wrote:
> 
> > ModelSwarm.o: In function `_c_ModelSwarm__createBegin_':
> >/swarm/swarmapps/majority03/ModelSwarm.m:18: undefined reference to
> >`__objc_class_name_Setter'
> >make: *** [Voter] Error 1
> 
> This is not a compiler error, in actuality it is a linker error.  Your code
> is compiling fine; the problem is that the linker cannot find the object
> code for the Setter class.

Paul E. Johnson                           address@hidden
Dept. of Political Science                Office: (913) 864-9086
University of Kansas                      FAX: (913) 864-5700
Lawrence, Kansas 66045                    Home: (913) 842-9916                  
   


                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.
                  ==================================


reply via email to

[Prev in Thread] Current Thread [Next in Thread]