![]() |
| ||
| strtok_r() error on solaris 8 Hi I am getting an error with some code, it compiles fine on linux but it is throwing an error on solaris, it is to do with strtok_r, the following is the error message: sku_cache.cpp:150: implicit declaration of function `int strtok_r(...)' sku_cache.cpp:150: assignment to `char *' from `int' lacks a cast The code in question is: char *svptr; As I said this compiles without error on linux but using solaris 8 it complains, on checking the man pages on both machines: Solaris: char * strtok_r(char *str, const char *sep, char **last); Linux: char *strtok_r(char *s, const char *delim, char **ptrptr); Any help would be greatly appreciated. Thanks Ben |
| ||
| Re: strtok_r() error on solaris 8 the compiler is telling u waht is wrong. the manual page apparently has an incorrect prototype, b/c gcc is telling u that it is returning an integer. try loooking at the header file and seeing if it has any notes on the function, or u can always try casting the return to a (char *) - but i dont think it is returning what u think it is. |
| ||
| Re: strtok_r() error on solaris 8 Hi infamous, Well on looking on /usr/include/string.h I find: extern char *strtok_r(char *, const char *, char **); When I attempt to change: char *s; to int s; I get rid of that error and get the following error: implicit declaration of function `int strtok_r(...)' Great isn't it, it says it wants an int even although there is no way I can see how the function would work with an int, when it an int it causes an error still. Any further advice graciously recieved. Thanks Ben |
| ||
| Re: strtok_r() error on solaris 8 Okay I have solved the problem, one of the other files in this program is using pthreads. which means I am linking with -lpthread, which includes its own thread safe version of strtok_r(), which does return an int value, however, by passing -D_REENTRANT to the compiler it uses the strtok_r in string.h instead of the one from the pthread library. It is supposed to be a known problem in solaris (but if it is well know it is very well hidden). Thanks for the help all the same. Ben |
| All times are GMT -4. The time now is 6:22 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC