delita
delita

Reputation: 1591

Error compiling python.h with C program

I am using eclipse and cygwin gcc compiler. Trying to use the Python.h for my C program but encounter these errors when compiling. Any ideas?

In file included from C:/Python27/include/python.h:86,
                 from ../src/EmbeddedPython.c:13:
C:/Python27/include/intobject.h:45: error: parse error before "PyInt_AsUnsignedLongLongMask"
C:/Python27/include/intobject.h:45: warning: type defaults to `int' in declaration of `PyInt_AsUnsignedLongLongMask'
C:/Python27/include/intobject.h:45: warning: data definition has no type or storage class
In file included from C:/Python27/include/python.h:88,
                 from ../src/EmbeddedPython.c:13:
C:/Python27/include/longobject.h:49: warning: parameter names (without types) in function declaration
C:/Python27/include/longobject.h:51: error: parse error before "PyLong_AsLongLong"
C:/Python27/include/longobject.h:51: warning: type defaults to `int' in declaration of `PyLong_AsLongLong'
C:/Python27/include/longobject.h:51: warning: data definition has no type or storage class
C:/Python27/include/longobject.h:52: error: parse error before "PyLong_AsUnsignedLongLong"
C:/Python27/include/longobject.h:52: warning: type defaults to `int' in declaration of `PyLong_AsUnsignedLongLong'
C:/Python27/include/longobject.h:52: warning: data definition has no type or storage class
C:/Python27/include/longobject.h:53: error: parse error before "PyLong_AsUnsignedLongLongMask"
C:/Python27/include/longobject.h:53: warning: type defaults to `int' in declaration of `PyLong_AsUnsignedLongLongMask'
C:/Python27/include/longobject.h:53: warning: data definition has no type or storage class
C:/Python27/include/longobject.h:54: error: parse error before "PyLong_AsLongLongAndOverflow"
C:/Python27/include/longobject.h:54: warning: type defaults to `int' in declaration of `PyLong_AsLongLongAndOverflow'
C:/Python27/include/longobject.h:54: warning: data definition has no type or storage class
make: *** [src/EmbeddedPython.o] Error 1

Upvotes: 1

Views: 877

Answers (1)

methodmain
methodmain

Reputation: 230

I don't know if this would help you out or not, but using gcc on OS X to compile a C program with embedded Python I had to link to the Python library. For instance from the command line I compiled:

gcc python_test.c -lpython2.7 -o python_test

where -l is the flag and python2.7 is my Python library folder.

Upvotes: 2

Related Questions