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_rfor your function name since it is already in the string.h library. Compiles fine if you usestrtok_rrror something.