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?
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.
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.
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.
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.
If you see this error while trying to install a Python library, follow https://stackoverflow.com/a/16588726/284795
Basically, remove visual studio 2010, then some registry keys manually then reinstall. Worked for me.
Related
I'm not familiar with this cross-compilation thing, but I do have successfully built wxMSW from Linux before, with the cross-compiler provided by my distro. So, I guess it's okay to say that I have some basic knowledge about cross-compilation. The question is that when cross-compiling, it failed and told me that EventToken.h is missing. According to Eventtoken.h header - Win32 apps | Microsoft Docs, it obviously is one of the header files of Windows' C++ Runtime. I don't have Windows, how and where can I install this header (and very likely some more other headers)? Installing VC++ is obviously not an option, because I don't have Windows at this moment. Thanks in advance. :)
I have successfully written a c++ code for finding the names of section headers and their range of virtual addresses in visual studio (working in windows XP) by reading an executable file.
Problem - Now I want to implement the same code in Linux environment.I am not an experienced Linux user , so therefore I am not aware of all the tools Linux provides. Is it possible to execute windows environment specific code in Linux . If yes how will it recognize header files such as windows.h & winNt.h.And of-course I have to make the executable file available in Linux too.
You should be able to write the code you describe portably, using only functions described in the C++ standard. Use std::ifstream, not CreatFile(), for example.
If you can write your program in visual studio with no reference to <windows.h>, then it will very likely run under Linux, too.
On the other hand, if all you are trying to do is to list the section headrs, try objdump -x foo.exe.
I noticed that the included headers for Windows development (such as Windows.h) are essentially for Windows XP and older. I am unable to call functions such as GetTickCount64 because they require Windows Vista or higher. I have Windows 7, but these functions are still absent. I understand that linking to such functions would increase the requirements on my program, and I am OK with that.
Does anyone have any experience with this? Can I use the newer Win32 API with mingw? How?
You can always download the very latest platform SDK and have all you need. Use the header and lib files from the SDK.
Having said that, it may be that all you need to do is to define _WIN32_WINNT and/or WINVER to 0x0600 or higher to gain access to more recent APIs. Off the top of my head, I'm not sure what Windows header file mingw ships with.
I'm modifying a large C++ project whose first release was Windows 7-only to work on Vista and XP.
The main work will be to change the W7 API calls to use GetProcAddress at runtime (to avoid static linking with methods that are not available on the other platforms), and so I'm wondering if there are any tools that can help identify which calls need to be changed -- hopefully by examining the C++ code itself.
Failing that, would it be best to try building the project against an older Windows SDK? -- for example: http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=6510
#define WINVER 0x501
Now everything that is newer than Windows XP will cause a compilation error.
Replace everything that causes an error until none remain.
If you have some sed-fu, you can probably write a filter that directly finds all #if WINVER > 0x501 blocks in the windows headers, but for me, this is a bit out of my scope :-)
I would open your binaries using the depends.exe tool (either from your VS install or from here) under WinXP and Vista to see which functions can't be statically linked under these OSes. These would be the functions which your binary is using, but which are missing in older releases of the OS. You'll have to deal with them somehow: either implement them by yourself, replace them with something else or disable some of the functionality of your app.
First I installed PSDK Windows Server 2003 R2 on my x86 machine, there were MFC header files out there. I tried to compile an example MFC application with cl.exe and I got this error message "winmsg_.h header file could not be opened.". I got "winmsg_.h" file from the International Network and put it into the MFC include files library then I again tried to compile the program and got that target platform option conflicts with IA64 platform specific object file. I think that PSDK Windows Server 2003 R2 does not include lib files for x86 machines!
Please help me to solve this problem or suggest me the PSDK that contains the header and lib files for x86 machines! Thanks!
Download SDK from Microsoft Website. It supports both 32 and 64 bit architectures. I'd suggest you to use a make file instead of barely using CL.exe for compilation. You will have to give proper include files to resolve the issues. Which version of the compiler you're using? How you installed it?
Don't go for a third party provided headers. Use the original ones.
I know this is old and people sometimes become upset when you revive a dead post. That said, Google brought me here, and I'm sure many others will be directed this way. This is what I, and I believe you, was/ were looking for:
http://www.codeproject.com/Articles/30439/How-to-compile-MFC-code-in-Visual-C-Express
ATL/MFC headers are not on Platofrm/Windows SDK. Instead, they are shipped with Visual Studio (except Express versions).