I'm currently trying to use googletest with MinGW and -std=c++0x
but it complains that _stricmp is not declared in this scope
which it doesn't when I do not use -std=c++0x
.
I have no idea what _stricmp
is, I just found out that it is defined in cstring/string.h
, so why is it gone in C++0x?
Asked
Active
Viewed 9,695 times
21
4 Answers
24
The -std=c++0x
option causes g++ to go into 'strict ANSI' mode so it doesn't declare non-standard functions (and _stricmp()
is non-standard - it's just a version of strcmp()
that's case-insensitive).
Use -std=gnu++0x
instead.

Michael Burr
- 333,147
- 50
- 533
- 760
-
8+1 But this is incredibly annoying. The whole GCC option thing has got out of control, IMHO. – Jun 10 '11 at 21:46
7
In addition to solution by Michael there is other method for overriding strict ANSI
mode. Include the following before any includes in file with compilation problems:
#ifdef __STRICT_ANSI__
#undef __STRICT_ANSI__
#endif
This helps not only with _stricmp
also with other common functions like swptintf
, vswprintf
and simmilar.

Yuriy Petrovskiy
- 7,888
- 10
- 30
- 34
-
1This one actually solved the problem for me, not Michael's answer. I agree with nbt, GCC options need a serious streamlining overhaul. – TheSHEEEP Mar 10 '15 at 13:44
0
I've had the exact same issue, but for me it was, that I've had a file String.h
in an include path, that was picked up by the proprocessor and used instead of the standard one. Found thanks to this thread.

Karol Stola
- 21
- 3
-
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/33540989) – sim Jan 05 '23 at 13:13