23

im trying to port application from cygwin to visual studio 2008 express
but im getting this error :

error C3861: 'strcasecmp': identifier not found  

in this type of code:

if (!strcasecmp("A0", s))  ....

what is the replacement in vs? i can't find any thing in the net

user63898
  • 29,839
  • 85
  • 272
  • 514

2 Answers2

49

add this to your precompiled header (or some other config.h)

#ifdef _MSC_VER 
//not #if defined(_WIN32) || defined(_WIN64) because we have strncasecmp in mingw
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#endif
Fantastory
  • 1,891
  • 21
  • 25
10

Look for

int _stricmp(
   const char *string1,
   const char *string2 );
Alexander Rautenberg
  • 2,205
  • 2
  • 22
  • 20
  • 1
    Thanks for the answer but could you expand a little? Is strcasecmp replaced now for the vs libraries? – Meep Dec 09 '13 at 16:17
  • 2
    @Meep strcasecmp() is a function specified by posix, which MSVC does not support. – nos Oct 14 '14 at 11:23