link redeclared as different kind of symbol in [...] works in simulator, not device

Member
Posts: 164
Joined: 2010.10
Post: #1
i have a objective-c program, i added a little lib with linked list in plain c. this is the header:
Code:
typedef struct node *link;
struct node { int v; link next; };
in simulator all compiles well, but when i try to compile for device this error occurs
link redeclared as different kind of symbol in...[...]
what is it?
how can i fix this?
thanks
Quote this message in a reply
Moderator
Posts: 691
Joined: 2002.04
Post: #2
I'm not sure why that would compile for the iOS Simulator but for for the device, but why not just remove the forward declaration by reorganising the declaration thus:

Code:
struct node { int v; struct node *next; };
typedef struct node *link;

(I'm also not sure what you would gain by doing that, given that you'll still have to remember that link l = malloc( sizeof( struct node )); - is not having to type an asterix worth that?)

Mark Bishop
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #3
You've omitted the most interesting part of the error message....
Quote this message in a reply
Member
Posts: 164
Joined: 2010.10
Post: #4
ok i'll try thanks, i have make so because i was instructed so by school Smile
mmm...interesting part...?
in [...] there are only name of the file that has inside: #include "linkedList.h"
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #5
The message should say where the first definition of link is...
Quote this message in a reply
Member
Posts: 164
Joined: 2010.10
Post: #6
thanks for the advice!
i have found that i have an #include "linkedList.h" in
helloworld.h and helloworld.m...
in simulator all went well...strange thing!

however another strange thing...:
in "linkedList.h" i have link and link2k defined in a similar way...but link2k does not gave me that error...mha!
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #7
maybe you're missing header guards on linkedList.h?
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #8
You can always just use #import instead of #include too. It's main function is to remove the need to use header guards.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Member
Posts: 164
Joined: 2010.10
Post: #9
i didn't know that was header guards Smile
thanks for suggestions!
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Kind of a noob question - finding artwork within my .app?? Nethfel 2 2,652 Mar 8, 2010 08:00 AM
Last Post: AndyKorth
  Multiple def. of symbol?? Greywhind 1 2,217 Jun 17, 2006 05:29 PM
Last Post: Greywhind
  Undefined symbol & getpixel Jones 7 4,259 May 21, 2006 01:14 AM
Last Post: OneSadCookie
  My first Cocoa Game that works! (Pong) blobbo 16 9,628 Aug 4, 2005 03:15 PM
Last Post: Andrew