Error: “no member named 'uint8_t' in the global namespace” on MacOS

匿名 (未验证) 提交于 2019-12-03 01:13:01

问题:

Chriss-MacBook-Pro-2:build louisduplessis$ cmake .. && make In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/utility:203: /Library/Developer/CommandLineTools/usr/include/c++/v1/cstdint:158:8: error: no       member named 'uint8_t' in the global namespace using::uint8_t;      ~~^ /Library/Developer/CommandLineTools/usr/include/c++/v1/cstdint:159:8: error: no       member named 'uint16_t' in the global namespace using::uint16_t;      ~~^ /Library/Developer/CommandLineTools/usr/include/c++/v1/cstdint:160:8: error: no       member named 'uint32_t' in the global namespace using::uint32_t;      ~~^ /Library/Developer/CommandLineTools/usr/include/c++/v1/cstdint:161:8: error: no       member named 'uint64_t' in the global namespace using::uint64_t;      ~~^ /Library/Developer/CommandLineTools/usr/include/c++/v1/cstdint:178:8: error: no       member named 'uint_fast8_t' in the global namespace using::uint_fast8_t;      ~~^ /Library/Developer/CommandLineTools/usr/include/c++/v1/cstdint:179:8: error: no       member named 'uint_fast16_t' in the global namespace using::uint_fast16_t;      ~~^ /Library/Developer/CommandLineTools/usr/include/c++/v1/cstdint:180:8: error: no       member named 'uint_fast32_t' in the global namespace using::uint_fast32_t;      ~~^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. make[2]: *** [CMakeFiles/path_planning.dir/src/main.cpp.o] Error 1 make[1]: *** [CMakeFiles/path_planning.dir/all] Error 2 make: *** [all] Error 2 

How do I fix these fatal errors? I installed cmake using brew, and these errors started appearing when I upgraded to a new Mac.

Does this have something to do with the preferences in cmake itself?

回答1:

I see the same error in npm install hummus or when I try clang++ test.cpp for

      #include <cstdint>        int main(int argc, char **argv) {          return 0;       }  

To compile, add the Mac SDK to the include paths:

clang++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk test.cpp



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!