C++ 编译项目失败,缺少io.h文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2211030/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
failing to compile a project, missing io.h file
提问by Pentium10
I fail to compile a C++ project for mobile device with Windows Mobile (Windows CE-based) operating system and Visual C++ compiler from Visual Studio fails with:
我无法为使用 Windows Mobile(基于 Windows CE)操作系统的移动设备编译 C++ 项目,并且 Visual Studio 的 Visual C++ 编译器失败:
Error 1 fatal error C1083: Cannot open include file: 'io.h'
EDIT
I am trying to compile the SQLite amalgamation, the shell.c file includes the call to this io.h but the io.h is missing from the files.
编辑
我正在尝试编译 SQLite 合并,shell.c 文件包含对此 io.h 的调用,但文件中缺少 io.h。
I googled and I couldn't locate how can I get this .h file.
我用谷歌搜索,但找不到如何获得这个 .h 文件。
Can someone point me in the right direction?
有人可以指出我正确的方向吗?
回答by mloskot
The io.h
file is notavailable in SDKs for Windows CE-based systems like Windows Mobile.
In fact, io.h
header has never been a part of ISO C nor C++ standards. It defines features that belongs POSIX compatibility layeron Windows NT, but not Windows CE.
该io.h
文件在基于 Windows CE 的系统(如 Windows Mobile)的 SDK 中不可用。事实上,io.h
header 从未成为 ISO C 或 C++ 标准的一部分。它定义了属于Windows NT 上的POSIX 兼容层的功能,但不属于Windows CE。
Due to lack of POSIX features on Windows CE, I developed a small utility library WCELIBCEX. It does include io.hbut a very minimal version and which is likely insufficient for SQLite. However, as ctackementioned, you should use SQLite port for Windows CEbecause original version of SQLite is not compilable for this platform.
由于 Windows CE 上缺少 POSIX 功能,我开发了一个小型实用程序库WCELIBCEX。它确实包含 io.h但它是一个非常小的版本,对于 SQLite 来说可能是不够的。但是,正如ctacke 所提到的,您应该为 Windows CE使用SQLite 端口,因为 SQLite 的原始版本不能为此平台编译。
p.s. Note, Your question does not specify explicitly that you're building for Windows Mobile. If one doesn't spot the .NET Compact Framework mentioned in tags, then the whole question is ambiguous.
ps 注意,您的问题没有明确说明您是为 Windows Mobile 构建的。如果没有发现标签中提到的 .NET Compact Framework,那么整个问题就是模棱两可的。
回答by Pentium10
It looks like io.h is part of standard VS, but proobably not part of WINCE edition (if there is one). From your dir /s it looks like you don't have it.
看起来 io.h 是标准 VS 的一部分,但可能不是 WINCE 版本的一部分(如果有的话)。从您的 dir /s 看起来您没有它。
I looked at shell.c and it does not include io.h that for wince:
我查看了 shell.c,它不包含用于 wince 的 io.h:
#if defined(_WIN32) || defined(WIN32)
# include <io.h>
#define isatty(h) _isatty(h)
#define access(f,m) _access((f),(m))
#else
/* Make sure isatty() has a prototype.
*/
extern int isatty();
#endif
#if defined(_WIN32_WCE)
/* Windows CE (arm-wince-mingw32ce-gcc) does not provide isatty()
* thus we always assume that we have a console. That can be
* overridden with the -batch command line option.
*/
#define isatty(x) 1
#endif
You are probably compiling with the wrong macros defined.
您可能正在使用定义的错误宏进行编译。
回答by ctacke
Have you considered looking at the project files from the SQLite for Windows CE siteto see how they got it to compile for CE? I've never seen native code files designed for the desktop ever "just compile" for Windows CE without having to do some preprocessor work and it's likely they've got the answers to what you need in those projects.
您是否考虑过查看SQLite for Windows CE 站点中的项目文件,以了解他们是如何为 CE 编译的?我从未见过专为桌面设计的本机代码文件为 Windows CE“直接编译”而无需做一些预处理工作,而且很可能他们已经得到了您在这些项目中需要的答案。
回答by cake
Found something that looks like your problem here. Apparently, althought io.h is a standard Microsoft header, there is no port of it to mobile plataforms.
在这里找到了看起来像你的问题的东西。显然,虽然 io.h 是标准的 Microsoft 标头,但它没有移植到移动平台上。
You are probably using some library that was not designed for use with mobile devices, and that library must be trying to use the non-mobile API.
您可能正在使用一些不是为与移动设备一起使用而设计的库,并且该库必须尝试使用非移动 API。
回答by Colonel Panic
If you see this error while trying to install a Python library, follow https://stackoverflow.com/a/16588726/284795
如果您在尝试安装 Python 库时看到此错误,请遵循https://stackoverflow.com/a/16588726/284795
Basically, remove visual studio 2010, then some registry keys manually then reinstall. Worked for me.
基本上,删除visual studio 2010,然后手动删除一些注册表项,然后重新安装。为我工作。