4

I converted my python program into c code with Cython. Now I'm having trouble compiling it with the MS Visual studio compiler. I'm getting the error

C:\Python34\include\pyconfig.h(68) : fatal error C1083: 
Cannot open include file: 'io.h': No such file or directory

I'm running the command from the conosle

cl /c main.c /nologo /Ox /MD /W3 /GS- /DNDEBUG 
-Ic:\Python34\include -Ic:\Python34\PC /link /OUT:"main.exe" 
the_prole
  • 8,275
  • 16
  • 78
  • 163
  • How did you configure Cython for MSVC? Do you have the same version of MSVC that was used to build your Python (and Cython)? – abarnert Nov 27 '14 at 00:44
  • 2
    Is the `INCLUDE` environment variable set to the MSVC include directory? e.g. `C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE` – Eryk Sun Nov 27 '14 at 01:55
  • 1
    @eryksun Do you mean set a second path variable to `C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE` ? Yes, I just tried that. I get the same error.. – the_prole Nov 27 '14 at 09:37

1 Answers1

3

I navigated to C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include on my computer, and the file io.h did not exist. It seems that that the problem is the file, in fact, does not exist!

According to this other answer, it is a POSIX compatibility library: failing to compile a project, missing io.h file

I'm not sure why this file can be missing. This other answer suggested reinstalling things: Installation of Visual Studio 2010 (any edition) installs only 2 files in the C++ headers directory

Edit: Everything just worked when I navigated to C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 2017\Visual Studio Tools. There were Developer Command Prompt for VS XXX shortcuts. I opened one of them and all the compilation commands succeeded.

Mark
  • 5,286
  • 5
  • 42
  • 73