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: error: conflicting type



On Jun 28, 2005, at 5:16 AM, sujeeshlal wrote:

I have tried to port my Linux application to MAC using XCode. In my project
I used some Xlib functions . But when I tried to include
 
#include <ApplicationServices/ApplicationServices.h>
#include <Carbon/Carbon.h>
 
to my existing  file which also contains
#include <X11/Xlib.h>
 
it shows some errors like
 
error:conflicting type for 'struct Cursor'
error: previous declaration as 'typedef XID Cursor'
 
.
How can I rectify this error.. Is that not possible to include Xlib.h and ApplicationServices.h at same time. I need both of this file. 

In general, you're not going to be able to #include both Xlib.h and ApplicationServices.h in the same file. They conflict in a number of places. I'm curious why you think that you need both headers in the same file. Much of the functionality that's provided by Carbon and ApplicationServices is already provided by X11, and vice-versa.

If you want to use a subset of Carbon, you'd be better off just #including the minimal set of headers that define the API you're using. Take a look at the headers that Carbon.h and ApplicationServices.h include, and only include the ones you need.

Alternatively, you can put all the Mac-specific code in a single .c file, and call into it from your other routines. That way the #includes in that file can just be the Mac-specific headers...

-Mark
 
 _______________________________________________
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: 
 >error: conflicting type (From: "sujeeshlal" <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.