Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

JayMan8081

macrumors regular
Original poster
Feb 20, 2007
115
0
Dayton, OH
I'm trying to install the ptypes library under OS X 10.4.10. It will compile and install correctly, but when I go to use the library in any application I get the following errors:
Code:
/usr/include/ptypes.h:39: error: declaration of C function 'void* pt::pexchange(void**, void*)' conflicts with
/usr/include/ptypes.h:38: error: previous declaration int pt::pexchange(int*, int)' here

My version of gcc/g++ is:
i686-apple-darwin8-gcc-4.0.1

and the ptypes library can be found here:
http://www.melikyan.com/ptypes/index.html

Does anyone have any suggestions? It's a C++ library and when it built it used g++ so I'm not sure why it is giving error message pertaining to C.
 

Sayer

macrumors 6502a
Jan 4, 2002
981
0
Austin, TX
C++ supports overloaded functions e.g. multiple versions of the same function with the same name, but different parameters while C doesn't.

Are you building a non-C++/Objective-C++ app?
 

JayMan8081

macrumors regular
Original poster
Feb 20, 2007
115
0
Dayton, OH
Nope, it's another C++ library that uses ptypes. It's also compiling with g++ which is why I can't understand why this error is occurring. I can't duplicate this on any other Macs here at the office either. Previously this has worked but I did a format and clean re-install and since then I haven't been able to use the ptypes library. Very weird. So far google hasn't helped either! I also verified that there were no extern C { } statements anywhere in my code or the ptypes library code. Any suggestions would be greatly welcomed at this point.
 

yeroen

macrumors 6502a
Mar 8, 2007
944
2
Cambridge, MA
That is weird.

I compiled a small test driver (statically linked against libptype.a however) with the same version of g++ you mentioned and it compiles fine.

Perhaps an #undef __cplusplus directive snuck into your code somewhere? Perhaps in some header file #include'd before ptypes.h?
 

JayMan8081

macrumors regular
Original poster
Feb 20, 2007
115
0
Dayton, OH
The error I'm getting is before it ever even gets to linking though. It won't even compile a source file that contains #include <ptypes.h> :(

Hmm I will check on the #undef
 

JayMan8081

macrumors regular
Original poster
Feb 20, 2007
115
0
Dayton, OH
No luck yet. Didn't find any #undef in any of my code or in any of the ptypes code. Thanks for the suggestions though! I'd rather have something to try than sitting around.
 

yeroen

macrumors 6502a
Mar 8, 2007
944
2
Cambridge, MA
What are compiler/linker flags are you using? What gcc/dyld environment variables are set?

Are you getting any compiler errors before it complains about the multiple declarations?
 

JayMan8081

macrumors regular
Original poster
Feb 20, 2007
115
0
Dayton, OH
Using
g++ -Wno-deprecated -I/usr/local/include -I../include
to compile the source files.

How do I find out what g++ and dyld env variables are set?

Edit: Not getting any other compiler errors before it complains about the multiple declarations.
 

JayMan8081

macrumors regular
Original poster
Feb 20, 2007
115
0
Dayton, OH
I'm making some progress on this issue. If I leave the header files in /usr/include/ptypes/ and add an -I/usr/include/ptypes/ to my makefile then everything compiles fine. If I don't do that I get the errors as exhibited in my original post. Does anyone have any ideas? I know that before my reinstall I was able to compile projects with ptypes headers that were symlinked in /usr/include/ to their /usr/include/ptypes/ counterparts.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.