[Plib-users] =?ISO-8859-1?Q?Re:_link_plib_into_code_on_mac_osx_=A0__?=
Brought to you by:
sjbaker
From: Bernhard W. <bw...@ca...> - 2004-10-29 10:40:30
|
This is a follow-up to the problem presented to the list. I managed to find a work-around to solve the problem that the gcc-compiler didn't seem to recognise the plib header files as being C++. Indeed, the whole problem disappeared by creating a soft link in the /usr/include/gcc/darwin/3.3/c++ directory pointing to the /usr/include/plib/-directory. Could it be the case that the compiler on Mac OS X assumes that the headers presented in /usr/include/ are C headers? And would it therefore make sense to create the plib-headers directory when using "make install" directly in /usr/include/gcc/darwin/3.3/c++ instead of in /usr/include? Thanks for the various help, Bernhard Steve Baker wrote: Bernhard Windisch wrote: > It is completely right that the compiler doesn"t recognise the language > of pu.h. The problem is that the application IS indeed written in C++ > and has been compiled using g++-3.3 without any problems as long as I > don"t include the header pu.h. But think about this - the header file is being "#include"d into the source for your application. The compiler doesn"t "recognise the language of pu.h" - it takes the ASCII characters inside that file and inserts them at that point into your application file. Then the resulting ASCII stream is compiled using whatever language the application is written in. The compiler doesn"t *see* included files as things to be compiled in their own right. So - it seems that your application is being compiled as C code - and not C++. Perhaps your application code is sufficiently C-like that it"s being successfully compiled as C - until you include some header files that are more certainly in C++. Why that should be, I"m not sure. > g++ -g -I/usr/include/gcc/darwin/3.3/c++ -c MePSim.C The ".C" extension (capital C) certainly indicates to the compiler that the code should be C++ - is it possible that something on the Mac is forcing the filename into lowercase before passing it to the compiler??!? Try renaming the source file to .cc or .cxx Another slightly odd thing is that the first error the compiler notices is: > /usr/include/plib/ul.h: In function `void ulEndianSwap(short unsigned int*)": > /usr/include/plib/ul.h:336: error: declaration of C function `void > ulEndianSwap(short unsigned int*)" conflicts with > /usr/include/plib/ul.h:327: error: previous declaration `void > ulEndianSwap(unsigned int*)" here ...well, there are a LOT of C++ language features earlier in ul.h that ought to have been flagged by the compiler if it thought it was compiling C. ---------------------------- Steve Baker ------------------------- HomeEmail: <sjbaker1@ai...> WorkEmail: <sjbaker@li...> HomePage : http://www.sjbaker.org Projects : http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net http://prettypoly.sf.net -----BEGIN GEEK CODE BLOCK----- GCS d-- s:+ a+ C++++$ UL+++$ P--- L++++$ E--- W+++ N o+ K? w--- !O M- V-- PS++ PE- Y-- PGP-- t+ 5 X R+++ tv b++ DI++ D G+ e++ h--(-) r+++ y++++ -----END GEEK CODE BLOCK----- |