Re: Link error using C dylib from C++ dylib
Re: Link error using C dylib from C++ dylib
- Subject: Re: Link error using C dylib from C++ dylib
- From: Jonathan Prescott <email@hidden>
- Date: Thu, 18 Sep 2008 12:04:49 -0400
Daniel:
I think the code should look like:
extern "C" {
#include "csource.h"
}
The include directive needs to be on a separate line so that the C/C++
pre-processor can expand the header file before it gets presented to
the compiler. If you keep what you wrote on 1 line (extern
"C" { #include "csource.h" }), the include directive gets missed by
the pre-processor.
Jonathan
On Sep 18, 2008, at 10:00 AM, Daniel Luis dos Santos wrote:
Hello,
I have an xcode project with one C source file and header file.
These are built into a BSD dylib.
Have another xcode project with a Cpp source file and header file. I
include the C source in the Cpp file in which one of the class's
methods I call the C function. The C header file inclusion is
surrounded by a extern "C" { #include "csource.h" }. I then drag the
built dylib from the C project into the link with libraries build
phase of the C++ target. The function from the C source is not found
by the linker.
Do I have to do anything else to get this to link ?
_______________________________________________
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
_______________________________________________
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