Trouble including Python.h

Marcelo Gosling marcelo.gosling at gmail.com
Sat Jun 24 00:58:49 CEST 2006


No, that didn't do the trick. The main reason I'm posting this here is
that I get all tese error messages just from including Python.h, the
code itself does absolutely nothing.

Cheers

vduber6er wrote:
> Try
>
> #undef _DEBUG
> #include "C:\Python24\include\python.h"
>
> or which ever path your python.h is located at
>
> works for me
>
> Marcelo Gosling wrote:
> > Hi, everyone.
> >
> > This is on WinXP SP2, with Python 2.4.3 and DJGPP gcc 4.1.0.
> >
> > I'm having trouble including Python.h in a C file. The following C
> > code:
> >
> > #include "Python.h"
> >
> > int main()
> > {
> >     return 0;
> > }
> >
> > when compiled with "gcc -I..\Python2.4\include\", gives more than 1000
> > lines of errors, beginning with:
> >
> > c:/documents and settings/marcelo.gosling/my
> > documents/djgpp/bin/as.exe: BFD 2.16.1 assertion fail
> > ../../bfd/coff-i386.c:576
> > c:/documents and settings/marcelo.gosling/my
> > documents/djgpp/tmp/ccACtxBR.s: Assembler messages:
> > c:/documents and settings/marcelo.gosling/my
> > documents/djgpp/tmp/ccACtxBR.s:28: Error: cannot represent relocation
> > type BFD_RELOC_386_PLT32
> > In file included from ../../Python2.4/include/Python.h:74,
> >                  from example_wrap.c:112:
> > ../../Python2.4/include/pymem.h: In function '__declspec':
> > ../../Python2.4/include/pymem.h:51: error: expected declaration
> > specifiers before '__declspec'
> > ../../Python2.4/include/pymem.h:52: error: expected declaration
> > specifiers before '__declspec'
> > In file included from ../../Python2.4/include/Python.h:76,
> >                  from example_wrap.c:112:
> > ../../Python2.4/include/object.h:104: error: storage class specified
> > for parameter 'PyObject'
> > ../../Python2.4/include/object.h:108: error: storage class specified
> > for parameter 'PyVarObject'
> > ../../Python2.4/include/object.h:126: error: expected '=', ',', ';',
> > 'asm' or '__attribute__' before '*' token
> > ../../Python2.4/include/object.h:127: error: expected '=', ',', ';',
> > 'asm' or '__attribute__' before '*' token
> > ../../Python2.4/include/object.h:128: error: expected '=', ',', ';',
> > 'asm' or '__attribute__' before '*' token
> > ../../Python2.4/include/object.h:129: error: expected ')' before '*'
> > token
> > ../../Python2.4/include/object.h:130: error: expected ')' before '*'
> > token
> >
> > Am I missing something important here?
> > 
> > Thanks in advance,
> > 
> > Marcelo




More information about the Python-list mailing list