iDevGames Forums
link redeclared as different kind of symbol in [...] works in simulator, not device - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: link redeclared as different kind of symbol in [...] works in simulator, not device (/thread-9122.html)



link redeclared as different kind of symbol in [...] works in simulator, not device - sefiroths - Jul 1, 2011 01:16 AM

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


RE: link redeclared as different kind of symbol in [...] works in simulator, not device - sealfin - Jul 1, 2011 03:22 AM

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?)


RE: link redeclared as different kind of symbol in [...] works in simulator, not device - OneSadCookie - Jul 1, 2011 07:50 AM

You've omitted the most interesting part of the error message....


RE: link redeclared as different kind of symbol in [...] works in simulator, not device - sefiroths - Jul 4, 2011 05:13 AM

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"


RE: link redeclared as different kind of symbol in [...] works in simulator, not device - OneSadCookie - Jul 4, 2011 08:24 AM

The message should say where the first definition of link is...


RE: link redeclared as different kind of symbol in [...] works in simulator, not device - sefiroths - Jul 6, 2011 02:13 AM

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!


RE: link redeclared as different kind of symbol in [...] works in simulator, not device - OneSadCookie - Jul 6, 2011 08:00 AM

maybe you're missing header guards on linkedList.h?


RE: link redeclared as different kind of symbol in [...] works in simulator, not device - Skorche - Jul 6, 2011 08:14 AM

You can always just use #import instead of #include too. It's main function is to remove the need to use header guards.


RE: link redeclared as different kind of symbol in [...] works in simulator, not device - sefiroths - Jul 7, 2011 12:43 AM

i didn't know that was header guards Smile
thanks for suggestions!