【发布时间】:2020-09-23 21:49:12
【问题描述】:
我正在尝试运行 c++ 代码,但是找不到 io.h。
'io.h' file not found
显示为
#include <io.h>
此外,我遇到了一堆奇怪的问题(对于超过 16 年的代码):
Use of undeclared identifier '_read'
或
Unknown type name '__int64'; did you mean '__int64_t'?
或
Use of undeclared identifier '_O_RDONLY'
或
Use of undeclared identifier '_lseeki64'; did you mean 'fseeko64'?
或
Cannot initialize a parameter of type 'FILE *' (aka '_IO_FILE *') with an lvalue of type 'int'
或
Use of undeclared identifier '_lseek'; did you mean 'fseek'?
或
Use of undeclared identifier '_close'
我想知道这些是否与找不到 io.h 有关。
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.1 LTS
Release: 20.04
Codename: focal
我有 CLion 2020.2.3 和
$ gcc --version
gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
【问题讨论】:
-
io.h这是哪里来的?这不是标准标题。这可能是某些 Windows 特定的东西吗? -
代码作者链接第三方库。您需要找出这是什么库并将其安装在您的机器上。
-
谷歌搜索 io.h 会抛出很多与 win32 相关的链接。根据您收到的错误消息,您可能会放弃对它的依赖并将其替换为 c++17 的 Filesystem library
-
谢谢,我猜你的意思是 io.h 不是 Windows 或 Linux 内核特定的文件,对吧?
-
它看起来很像 Windows 特有的东西。
标签: c++ linux ubuntu gcc clion