janstarke / rexgen

API Documentation
https://github.com/janstarke/rexgen/blob/master/doc/api.md
GNU General Public License v2.0
52 stars 21 forks source link

Build fails on OSX after fixing #43 #44

Closed magnumripper closed 7 years ago

magnumripper commented 7 years ago
[ 83%] Building CXX object librexgen/CMakeFiles/librexgen.dir/c/simplestring.cpp.o
/Users/magnum/src/rexgen/src/librexgen/c/simplestring.cpp:48:31: error: no member named 'setlocale'
      in namespace 'std'
  char* current_locale = std::setlocale(LC_ALL, NULL);
                         ~~~~~^
/Users/magnum/src/rexgen/src/librexgen/c/simplestring.cpp:48:41: error: use of undeclared identifier
      'LC_ALL'
  char* current_locale = std::setlocale(LC_ALL, NULL);
                                        ^
/Users/magnum/src/rexgen/src/librexgen/c/simplestring.cpp:49:8: error: no member named 'setlocale' in
      namespace 'std'
  std::setlocale(LC_ALL, "en_US.UTF-8");
  ~~~~~^
/Users/magnum/src/rexgen/src/librexgen/c/simplestring.cpp:49:18: error: use of undeclared identifier
      'LC_ALL'
  std::setlocale(LC_ALL, "en_US.UTF-8");
                 ^
/Users/magnum/src/rexgen/src/librexgen/c/simplestring.cpp:54:16: error: no member named 'mblen' in
      namespace 'std'; did you mean simply 'mblen'?
    int next = std::mblen(ptr, end-ptr);
               ^~~~~~~~~~
               mblen
/usr/include/stdlib.h:153:6: note: 'mblen' declared here
int      mblen(const char *__s, size_t __n);
         ^
/Users/magnum/src/rexgen/src/librexgen/c/simplestring.cpp:59:5: error: no member named 'mbtowc' in
      namespace 'std'; did you mean simply 'mbtowc'?
    std::mbtowc(&wc, ptr, end-ptr);
    ^~~~~~~~~~~
    mbtowc
/usr/include/stdlib.h:155:6: note: 'mbtowc' declared here
int      mbtowc(wchar_t * __restrict, const char * __restrict, size_t);
         ^
/Users/magnum/src/rexgen/src/librexgen/c/simplestring.cpp:60:22: error: no member named 'wctomb' in
      namespace 'std'; did you mean simply 'wctomb'?
    const int size = std::wctomb(&tmp_buffer[0], wc);
                     ^~~~~~~~~~~
                     wctomb
/usr/include/stdlib.h:192:6: note: 'wctomb' declared here
int      wctomb(char *, wchar_t);
         ^
/Users/magnum/src/rexgen/src/librexgen/c/simplestring.cpp:73:18: error: use of undeclared identifier
      'LC_ALL'; did you mean 'P_ALL'?
  std::setlocale(LC_ALL, current_locale);
                 ^~~~~~
                 P_ALL
/usr/include/sys/wait.h:80:2: note: 'P_ALL' declared here
        P_ALL,
        ^
/Users/magnum/src/rexgen/src/librexgen/c/simplestring.cpp:73:8: error: no member named 'setlocale' in
      namespace 'std'
  std::setlocale(LC_ALL, current_locale);
  ~~~~~^
9 errors generated.
make[2]: *** [librexgen/CMakeFiles/librexgen.dir/c/simplestring.cpp.o] Error 1
make[1]: *** [librexgen/CMakeFiles/librexgen.dir/all] Error 2
make: *** [all] Error 2
janstarke commented 7 years ago

I fixed this, but I'm not happy with this.

When working on my Mac, my IDE thinks that stdexcept is not necessary; when working with Ubuntu, the same IDE says that cstdlib and clocale are not required. If I remove them, matching to the suggestions of my IDE, I can compile on one system, but not on the other. Do I need to keep all includes and live with the warnings? Or is there a better way to handle such things?