g++ error: ‘stricmp’ was not declared in this scope (but OK for 'strcmp')

stricmp is neither POSIX nor ANSI, so it doesn't really matter if strcmp is allowed, if your compiler or standard library is strictly adhering to POSIX or ANSI standard library functions (as is probably the case with the GCC suite).


Try strcasecmp(). Here's the manual page for it. It is conforming to 4.4BSD and POSIX.1-2001.


Add a define for it to overwrite stricmp with strcasecmp on the platforms you are looking for.

#ifdef _IPHONE <- your platform define here
#define stricmp strcasecmp
#define strnicmp strncasecmp
#endif

Then you can just use stricmp always.

Tags:

C++

G++