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

qwerty2k

macrumors regular
Original poster
Dec 27, 2007
157
5
Hi, i was previously coding a project in Linux using CodeBlocks, it is using boost, guichan gui library and sdl as a backend. Ive imported my project into XCode and put all the required libraries etc into the project.

However im getting some compile errors.

the errors are in the complex numbers standard c++ header:

error: 'snprintf' is not a member of 'std'
error: '__pow_helper' is not a member of 'std'

Now these are standard c++ headers, i haven't altered any of them so i am at a loss as to why they won't compile.
 

parapup

macrumors 65816
Oct 31, 2006
1,291
49
error: 'snprintf' is not a member of 'std'
error: '__pow_helper' is not a member of 'std'

Looks like it's namespace resolution related - your default namespace seems to be set to std (using namespace std) and the C functions are part of global namespace specified explicity by prefixing :: to the function.

So try using ::snprintf and the like and see if that resolves the errors.
 

qwerty2k

macrumors regular
Original poster
Dec 27, 2007
157
5
how can i open the file as an admin because its in an area a normal user can't edit (also in the file there are lots of references to functions prefixed with std:: and it doesn't error out on any of them)
 

parapup

macrumors 65816
Oct 31, 2006
1,291
49
Ok, I missed the part about the error being in standard headers.

Can you #include <cstring> *before* #including the standard header which gives you the snprintf error and see?
 

qwerty2k

macrumors regular
Original poster
Dec 27, 2007
157
5
didn't work, gave me even more errors, the fsprintf errors are now in c++locale.h in the following bit of code:

#ifdef _GLIBCXX_USE_C99
const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
#else
const int __ret = std::sprintf(__out, __fmt, __prec, __v);
#endif


i was thinking maybe its to do with gcc4? since iirc on ubuntu when i was coding i was compiling with gcc3?
 

parapup

macrumors 65816
Oct 31, 2006
1,291
49
i was thinking maybe its to do with gcc4? since iirc on ubuntu when i was coding i was compiling with gcc3?

Yeah - sounds like some weird gcc/libstdc++ bug. But before I give up I have one last thing for you to try - #include <cstdio> and #include <cstdarg> in the files where you use snprintf - that _should_ get rid of the snprintf error I think.
 

parapup

macrumors 65816
Oct 31, 2006
1,291
49
thank you for your suggestions, however the error still occurs :(

Hmm I am intrigued - do you have a reduced test case - like may be just copy the failing part of the code and create a standalone header and .cpp to reproduce this? If so post the .h/.cpp here and I will try to see what's going on.

What version of gcc (gcc -v) are you compiling this under?
 

Nerdcoder

macrumors newbie
Sep 6, 2006
3
0
Found a solution

Hi digging around for a solution, I found a comment suggesting that using the recursive checkbox i include paths was the problem.

It was!.. Strange...
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.