Skip to content
This repository has been archived by the owner on Feb 15, 2023. It is now read-only.

MSVC: <strings.h> does not exist in Windows #411

Closed
kolomenkin opened this issue Aug 9, 2019 · 2 comments
Closed

MSVC: <strings.h> does not exist in Windows #411

kolomenkin opened this issue Aug 9, 2019 · 2 comments

Comments

@kolomenkin
Copy link

kolomenkin commented Aug 9, 2019

There is no <strings.h> in Windows.

Only two functions are needed by gumbo parser from <strings.h>:

  • strcasecmp
  • strncasecmp

_stricmp from <string.h> completely does the same as strcasecmp
_strnicmp from <string.h> completely does the same as strncasecmp

Here is my solution for Windows:

#if defined(_WIN32) || defined(_WIN64) 
#  include <string.h>
#  define strcasecmp _stricmp 
#  define strncasecmp _strnicmp 
#else
#  include <strings.h>
#endif
@kolomenkin kolomenkin changed the title MSVC: <strings.h> does not exist MSVC: <strings.h> does not exist in Windows Aug 9, 2019
@crazydef
Copy link

crazydef commented Sep 20, 2019

This solution doesn't work because compilers on Linux don't handle directory paths the same way as Visual Studio does. They always search user paths before system paths, and so the #include <strings.h> results in a circular include that never exits.

@kolomenkin
Copy link
Author

kolomenkin commented Apr 6, 2021

We could have file like local_strings.h with the code from my proposal.
And update Gumbo parser to include "local_strings.h" instead of <strings.h>

It will avoid the problem with include recursion.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants