We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In linenoise.cpp, in the #ifdefs for _WIN32, headers <string.h> (should be <cstring>) are not included, leading to undefined decls for strdup, etc.
linenoise.cpp
#ifdef
_WIN32
<string.h>
<cstring>
strdup
So change the head of linenoise.cpp to:
/* gcc's C++17 mode hides most of signal.h */ #if defined(__GNUC__) #define _GNU_SOURCE #endif #include <cstdlib> #include <cstdio> #include <cctype> #include <cstring> #include <errno.h> #include <fcntl.h> #include <signal.h> #include <sys/stat.h> #include <sys/types.h> #include <string> #include <vector> #include <unordered_map> #include <memory> #include <atomic> #ifdef _WIN32 #include <conio.h> #include <windows.h> #include <io.h> // thanks @Technici4n [180385768a] #if defined(_MSC_VER) && _MSC_VER < 1900 #define snprintf _snprintf// Microsoft headers use underscores in some names #endif #define isatty _isatty #define write _write #define STDIN_FILENO 0 #else /* _WIN32 */ #include <termios.h> #include <unistd.h> // thanks @theopolis commit [30d97e1d4] from [c894b9e] in linenoise: #include <sys/ioctl.h> #include <wctype.h> #include <poll.h> #endif /* _WIN32 */ #include "linenoise.h" #include "ConvertUTF.h"
and, additionally,
#if !defined(__GNUC__) static char* strdup(const char* s) { size_t slen; char* result; slen = strlen(s); result = (char*)malloc(slen + 1); if(result == NULL) { return NULL; } memcpy(result, s, slen+1); return result; } static strcasecmp(const char* instring1, const char* instring2) { int rt; const unsigned char *ptr1; const unsigned char *ptr2; ptr1 = (const unsigned char*)instring1; ptr2 = (const unsigned char*)instring2; if(ptr1 == ptr2) { return 0; } while((rt = (std::tolower(*ptr1) - std::tolower(*ptr2++))) == 0) { if (*ptr1++ == 0) { break; } } return rt; } #endif
for strdup and strcasecmp
The text was updated successfully, but these errors were encountered:
No branches or pull requests
In
linenoise.cpp
, in the#ifdef
s for_WIN32
, headers<string.h>
(should be<cstring>
) are not included, leading to undefined decls forstrdup
, etc.So change the head of
linenoise.cpp
to:and, additionally,
for strdup and strcasecmp
The text was updated successfully, but these errors were encountered: