Re: Linker error: symbol(s) not found
Re: Linker error: symbol(s) not found
- Subject: Re: Linker error: symbol(s) not found
- From: "Julien Jalon" <email@hidden>
- Date: Wed, 3 Sep 2008 23:02:01 +0200
In the header declaring DGBoardRepFromGame, make sure to declare it extern
"C".
#ifdef __cplusplus
extern "C" {
#endif
extern DGBoardRepFromGame(DGGame*, char*);
#ifdef __cplusplus
}
#endif
On Wed, Sep 3, 2008 at 10:40 PM, Joachim <email@hidden> wrote:
> Dear list,
>
> I'm getting a linker error, and it's not a missing inclusion of a
> framework. I suspect it has to do with mixing .m and .mm files, but I'm
> actually pretty clueless.
>
> This is the output from the build:
>
> "DGBoardRepFromGame(DGGame*, char*)", referenced from:
> -[DGTinyEngine setPositionFromGame:error:] in DGTinyEngine.o
> ld: symbol(s) not found
> collect2: ld returned 1 exit status
>
> In my otherwise Objective-C only project, DGTinyEngine.mm is using a C++
> engine, hence the need to make it an Objective-C++ file. It imports a
> "DGFunctions.h" file that amongst other general C functions declares the
> void DGBoardRepFromGame (DGGame *game, DGBoardRep buffer) function. The
> function is implemented in a .m file.
>
> It is the call in DGTinyEngine.mm to this function that causes the linker
> error. If I comment out the call to DGBoardRepFromGame, the project links
> fine. DGGame is an Objective-C class that is used several places in
> DGTinyEngine.mm without causing any problems.
>
> What causes the linker error, and what can I do to avoid it?
>
> Thanks in advance,
> Joachim
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden