【问题标题】:Clang can't find cinttypes after fresh Ubuntu Install全新安装 Ubuntu 后 Clang 找不到 cinttypes
【发布时间】:2022-12-10 00:20:58
【问题描述】:

正如标题所说。这是一个全新的 Ubuntu 安装,虽然 g++ 编译我的代码没问题,但 clang++ 告诉我它找不到 cinttypes 任何修复?

编辑:按照要求,这是 echo | clang -E -dM -xc++ - | egrep __cplusplus 的输出:#define __cplusplus 201402L

编辑:这是一个最小的可重现示例,后跟错误消息:

#include <cinttypes>
int main() { return 0;}

clang++ 测试.cpp

test.cpp:1:10: fatal error: 'cinttypes' file not found
#include <cinttypes>

尝试使用 g++ 编译时没有错误

【问题讨论】:

  • 也许包括路径设置?
  • cinttypes需要c++11clang++ 安装采用的默认语言标准是什么(尽管我很难相信它低于c++11)。请edit你的问题来显示echo | clang -E -dM -xc++ - | egrep __cplusplus的输出。
  • 请提供代码——最好是minimal reproducible example——并逐字提供错误消息。
  • 我已经提供了这两个

标签: c++ gcc clang clang++


【解决方案1】:

我终于能够通过 sudo apt install libc++abi-dev libstdc++-dev 解决这个问题

【讨论】:

    猜你喜欢
    • 2013-08-31
    • 1970-01-01
    • 1970-01-01
    • 2020-08-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-29
    • 2020-10-04
    相关资源
    最近更新 更多