views:

381

answers:

6

Hello,

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:

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.

I googled and I couldn't locate how can I get this .h file.

Can someone point me in the right direction?

A: 

You will likely need the development files for the SQLlite library. These development files will come with a number of header files (probably io.h). Once you have those you will need to add the include directory of the SQLlite development library to your include path.

Pace
I supposed that how will go, but not. I've downloaded the first option listed on this page: http://www.sqlite.org/download.html
Pentium10
A: 

My sqlite.c/sqlite.h amalgamation don't reference io.h. Sounds like it might be elsewhere in your code? io.h is a standard Microsoft header, what are you compiling for?

Joe
I understood that the amalgamation doesn't contain main(). So I included the shell.c, and there is a section referencing io.h
Pentium10
OH, sorry, I was talking the library.What platform are you building for? That's a MS header file, are you building for a MS device? It's possible that the device you're building doesn't have console-type support?
Joe
I am building for Compact-Framework (Windows Mobile CF 5.0), for a mobile device.
Pentium10
A: 

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.

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.

cake
+2  A: 

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.

I looked at shell.c and it does not include io.h that for wince:

#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.

Moron
where can I change those macros you are talking about and with what?
Pentium10
First step would be to figure out what Macros are being used. The VS compilation should give you a log of the complete command line. Once you figure out what macros are being used, and that is really the problem, you should be able to add your own macros (or DEFINES) through the VS project options. It could also be that you have specified the wrong target when compiling, making VS choose the wrong macros
Moron
The weirdest thing is I haven't found a compiled sqlite for WinMobile. I was wondering if someone has done this. I think there are already ported sqlite shells to windows mobile but I was unable to locate a build for them.
Pentium10
+1  A: 

Have you considered looking at the project files from the SQLite for Windows CE site to 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.

ctacke
+1  A: 

The io.h file is not available 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 layer on Windows NT, but not Windows CE.

Due to lack of POSIX features on Windows CE, I developed a small utility library WCELIBCEX. It does include io.h but a very minimal version and which is likely insufficient for SQLite. However, as ctacke mentioned, you should use SQLite port for Windows CE because original version of SQLite is not compilable for this platform.

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.

mloskot