Build c++ example error


(wechat:lixianjie0518) #1

OS:MacOS Mojave 10.14.1 (18B75),python3.6
I want to try the c++ example for my image project,I read https://pytorch.org/cppdocs/installing.html#minimal-example,step by step do it.
when I “make”,it shows error message:

Scanning dependencies of target example-app
[ 50%] Building CXX object CMakeFiles/example-app.dir/example-app.cpp.o
In file included from /Users/lixianjie/Desktop/cpp/libtorch/include/torch/csrc/jit/script/tree.h:7:0,
                 from /Users/lixianjie/Desktop/cpp/libtorch/include/torch/csrc/jit/script/error_report.h:3,
                 from /Users/lixianjie/Desktop/cpp/libtorch/include/torch/csrc/jit/script/compiler.h:7,
                 from /Users/lixianjie/Desktop/cpp/libtorch/include/torch/csrc/api/include/torch/jit.h:3,
                 from /Users/lixianjie/Desktop/cpp/libtorch/include/torch/csrc/api/include/torch/all.h:5,
                 from /Users/lixianjie/Desktop/cpp/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /Users/lixianjie/Desktop/cpp/test/example-app.cpp:8:
/Users/lixianjie/Desktop/cpp/libtorch/include/torch/csrc/jit/script/lexer.h: In static member function ‘static double torch::jit::script::SharedParserData::strtod_c(const char*, char**)’:
/Users/lixianjie/Desktop/cpp/libtorch/include/torch/csrc/jit/script/lexer.h:169:12: error: ‘locale_t’ does not name a type
     static locale_t loc = newlocale(LC_ALL_MASK, "C", nullptr);
            ^
/Users/lixianjie/Desktop/cpp/libtorch/include/torch/csrc/jit/script/lexer.h:170:31: error: ‘loc’ was not declared in this scope
     return strtod_l(str, end, loc);
                               ^
/Users/lixianjie/Desktop/cpp/libtorch/include/torch/csrc/jit/script/lexer.h:170:34: error: ‘strtod_l’ was not declared in this scope
     return strtod_l(str, end, loc);
                                  ^
make[2]: *** [CMakeFiles/example-app.dir/example-app.cpp.o] Error 1
make[1]: *** [CMakeFiles/example-app.dir/all] Error 2