I am having a strange compile time error message when attempting to compile one of the files in my codebase.
What makes this error more wierd is that it only occurs when I'm building in release mode - it compiles with no problem in Debug mode.
Below is the (entire) content of the offending file:
#include <string.h>
char * strtok_r(char *s, const char *delim, char **save_ptr)
{
char *token;
if (s == NULL)
s = *save_ptr;
s += strspn (s, delim);
if (*s == '\0')
return NULL;
token = s;
s = strpbrk (token, delim);
if (s == NULL)
*save_ptr = strchr (token, '\0');
else
{
*s = '\0';
*save_ptr = s + 1;
}
return token;
}
I am compiling with gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3 on Ubuntu 10.0.4
Does anyone know why I am getting this error?
You cant use the name strtok_r for your function name since it is already in the string.h library. Compiles fine if you use strtok_rrr or something.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With