NO

Author Topic: strtok_s() missing prototype  (Read 4892 times)

robal

  • Guest
strtok_s() missing prototype
« on: June 12, 2008, 12:10:58 PM »
Hi,

I'm writing a threaded application.
I'm having a situation where I wanted to STRTOK in a reentrant way (strtok loop which does another strtok inside each iteration).
Therefore I wanted to use reentrant, thread safe STRTOK_S.

I get " Missing prototype for 'strtok_s' ".

I have string.h included. Standard 'strtok' is compiling and working fine.

Does anyone know why do I get this compilation error ?
I can see declaration of strtok_s in the string.h file.

Cheers,


robal

  • Guest
Re: strtok_s() missing prototype
« Reply #1 on: June 12, 2008, 12:33:52 PM »
OK,

I've found an aswer...  ...in Pelles C help :)


For people who may run into this problem:

Look for 'ISO TR24731-1' in Pelles C help.
To use thread safe routines like strtok_s, you need to define that you want them BEFORE you include headers.
In case of strtok_s:

#define __STDC_WANT_LIB_EXT1__  1
#include <string.h>


That fixed the problem.

Cheers