Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mixing obective-C and c++



If it's a procedure, you need to tell the compiler to not name mangle it... wrap the prototype with:

#ifdef __cplusplus
extern "C" {
#endif

(void) myFunction(void);

#ifdef __cplusplus
}
#endif

On Apr 7, 2007, at 9:03 AM, Livio Isaia wrote:

Firstly, many thanks to everybody for helping.

So here is a new problem.
I have a ".c++" file with a procedure called from a ".m" file (Cocoa). But XCode tells me "undefined symbol" when linking (I turned off ZeroLink).


Let's say I have
   theCFile.h declaring theCProcedure,
   theCFile.c++ containing theCProcedure
   and theCocoaFile.m calling theCProcedure.

All files are in the same project; when building everything seems ok; I set "#include "theCFile.h"" in theCocoaFile.m; the target of theCFile.c++ is the target application...

I shouldn't be surprised if it couldn't link with some libraries called from theCFile.c++, but linking with theCFile.o?
Can you help some way?


Many thanks again,
regards, livio.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/dave% 40criticalpath.com


This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/xcode-users/email@hidden

This email sent to email@hidden
References: 
 >Mixing obective-C and c++ (From: Livio Isaia <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.