On Dec 7, 12:32 pm, grbgooglefan <[EMAIL PROTECTED]> wrote: > I am compiling CPP program which uses CPython API functions from > Python 2.5.1 source code > > First I compiled with this commanline, that time I got "pyconfig.h" > not found. > g++ -Os -I../../Include ../../libpython2.5.a -lm -ldl -lpthread -lutil > testeval.cpp > In file included from testeval.cpp:1: > ../../Include/Python.h:8:22: pyconfig.h: No such file or directory > In file included from ../../Include/Python.h:57, from > testeval.cpp:1: > ../../Include/pyport.h:4:48: pyconfig.h: No such file or directory > ../../Include/pyport.h:734:2: #error "LONG_BIT definition appears > wrong for platform (bad gcc/glibc config?)." > > So, I added "-I../../PC" to my cmd line to get pyconfig.h, like: > g++ -Os -I../../Include -I../../PC/ ../../libpython2.5.a -lm -ldl - > lpthread -lutil testeval.cpp > > As soon as I ran this command I got a long list of errors as shown > below. > Why the dllimport errors are coming? I did not get these errors when I > did same compilation with Python 2.2.3. > Please help. Thanks. > > In file included from ../../Include/Python.h:76, from > testeval.cpp:1: > ../../Include/pymem.h:50: `dllimport' was not declared in this scope > ../../Include/pymem.h:50: ISO C++ forbids declaration of `__declspec' > with no type > ../../Include/pymem.h:50: syntax error before `void' > ../../Include/pymem.h:51: `dllimport' was not declared in this scope > ../../Include/pymem.h:51: ISO C++ forbids declaration of `__declspec' > with no type > ../../Include/pymem.h:51: redefinition of `int __declspec' > ../../Include/pymem.h:50: `int __declspec' previously defined here > ../../Include/pymem.h:51: syntax error before `void' > ../../Include/pymem.h:52: `dllimport' was not declared in this scope > ../../Include/pymem.h:52: ISO C++ forbids declaration of `__declspec' > with no type > ../../Include/pymem.h:52: redefinition of `int __declspec' > ../../Include/pymem.h:51: `int __declspec' previously defined here > ../../Include/pymem.h:52: syntax error before `void' > In file included from ../../Include/Python.h:78, from > testeval.cpp:1: > ../../Include/object.h:371: `dllimport' was not declared in this scope > ../../Include/object.h:371: ISO C++ forbids declaration of > `__declspec' with no type > ../../Include/object.h:371: redefinition of `int __declspec' > .............. > ../../Include/Python.h:134: redefinition of `int __declspec' > ../../Include/pystrtod.h:11: `int __declspec' previously defined here > ../../Include/Python.h:134: syntax error before `*' token > testeval.cpp: In function `int main(int, char**)': > testeval.cpp:94: `Py_Initialize' undeclared (first use this function) > testeval.cpp:94: (Each undeclared identifier is reported only once for > each > function it appears in.) > testeval.cpp:95: `PyRun_SimpleStringFlags' undeclared (first use this > function)
I am doing this on following Linux OS config: Linux njl36a-7003 2.4.21-9.0.1.ELsmp #1 SMP Mon Feb 9 22:26:51 EST 2004 i686 i686 i386 GNU/Linux >cat /etc/redhat-release Red Hat Enterprise Linux AS release 3 (Taroon Update 1) -- http://mail.python.org/mailman/listinfo/python-list