Re: [Plib-users] link plib into code on mac osx
Brought to you by:
sjbaker
From: Steve B. <sjb...@ai...> - 2004-10-23 14:21:13
|
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: <sjb...@ai...> WorkEmail: <sj...@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----- |