1

I am trying to include this line in my .c code

#include <Python.h>

All I have in my helloworld.c is

#include <stdio.h>
#include <Python.h>

int main()
{
    printf("Hi, this is me. \n");
    system("pause");
    return 0;
}

I haven't wrote anything that use the python.h yet, since I haven't been able to compile. This is the error I get:

fatal error C1083: Cannot open include file: 'Python.h': No such file or directory

I am using CL.exe, the visual studio 2017 's command line compiler to run this:

cl /LD helloworld.c

How do I let the compiler know where my python.h is?

11
  • /LD? Are you sure? Commented May 6, 2018 at 9:02
  • You want use option /? and read? Commented May 6, 2018 at 9:03
  • yes, I am trying to write a .DLL for my python to call. Commented May 6, 2018 at 9:03
  • Sorry I should have said that. Commented May 6, 2018 at 9:03
  • This might help as well: msdn.microsoft.com/en-us/library/fwkeyyhe.aspx - still you need to read it ;-) Commented May 6, 2018 at 9:05

1 Answer 1

2
cl /LD /I C:\python\include hello.c C:\python\libs\python36.lib
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.