Re: C with C++ in xcode
Re: C with C++ in xcode
- Subject: Re: C with C++ in xcode
- From: Markian Hlynka <email@hidden>
- Date: Tue, 27 Sep 2005 19:32:54 -0600
Eric, you beat me to it by half a minute! :-)
I just wanted to add that if for some reason you really can't modify
the C header files, you could probably do what eric describes
slightly differently. In your c++ .h file:
#ifdef __cplusplus
extern "C"{
#include "mycfile.h"
}
#endif
This is icky, but at least if you do it this way, and cplusplus is at
some point not defined, you'll get all sorts of errors because your c
header(s) won't be included either. This is also ugly because you'd
have to do it every time you wanted to include mycfile.h. But, if
it's only once, it might be worth it <shrug>.
Markian
I want to use some C code with my Carbon project.
I have some un-adulterated .c files (and their .h
counterparts) that I have added to the project. The
problem seems to be that I don't know how to call them
from within a class's member function.
Your .h file needs to define those functions as C functions, not C+
+ functions. To do that, in each .h file add this to the start of
the file:
#ifdef __cplusplus
extern "C" {
#endif
and add this to the end of the file:
#ifdef __cplusplus
}
#endif
Hope this helps,
Eric
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40cs.ualberta.ca
This email sent to email@hidden
----
When arguing with an idiot, be sure they aren't doing the same.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden