Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Mac Programming / October 2005



Tip: Looking for answers? Try searching our database.

Weird compilation error - depends on header location

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
James - 13 Oct 2005 11:28 GMT
Hi

I've been looking at plib - a portable games library. I got it built and
installed OK but have come across a strange compile error. I have
distilled it down to this:

---start---
#include "ul.h"
//#include <plib/ul.h>

int main()
{
 return 0;
}
----end----

If I include from a local copy of the header it works - but it fails if I use
the system include variant. It complains about a bunch of overloaded inline
functions:

/usr/include/plib/ul.h: In function 'void ulEndianSwap(short unsigned int*)':
/usr/include/plib/ul.h:342: error: declaration of C function 'void ulEndianSwap(short unsigned int*)' conflicts with
/usr/include/plib/ul.h:333: error: previous declaration 'void ulEndianSwap(unsigned int*)' here

and much more in a similar vein...

It looks like it's treating the header as a C header rather than C++ - why would
that be? Any ideas?

I've put a copy of ul.h up at <http://weatherley.net/src/ul.h>
James - 13 Oct 2005 14:49 GMT
I can answer my own question. After diffing the preprocessor output of a ""
include and a <> include I can see that OS X implicitly 'extern C's includes
in /usr/include. Moving the plib headers to /usr/local/include let me use <>
style includes successfully with the plib headers.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.