Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c++

g++

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


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).


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.