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 PROTECTED]> 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 (Cocoa-dev@lists.apple.com)
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/jjalon%40gmail.com
>
> This email sent to [EMAIL PROTECTED]
>
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to