Newbie - C API Question
Chris Gonnerman
chris.gonnerman at newcenturycomputers.net
Mon Mar 31 09:06:09 EST 2003
----- Original Message -----
From: "Ian Pellew" <ipellew at pipemedia.co.uk>
> Hi;
>
> This is my first attempt at getting to and from my C world.
>
> I cannot get past Python Reference Manual(2.2.1) section 1.2.1.1 :-
>
> h.c:-
> #include "Python.h"
> main() {
> int x;
> PyObject *t;
> t = PyTuple_New(3);
> x = Py_file_input;
> printf("Hiya, x = %d\n", x);
> }
>
> My compile gives:-
> [ `gcc -I/usr/local/include/python2.1 -o h h.c` ] && { ./h; }
> Undefined first referenced
> symbol in file
> PyList_New /var/tmp//ccNWkGt5.o
> ld: fatal: Symbol referencing errors. No output written to h
> collect2: ld returned 1 exit status
>
> I am on Sun Solaris 5.8
> Python 2.1.1 (#1, Aug 25 2001, 04:19:08)
> [GCC 3.0.1] on sunos5
>
> Any pointers/advice please;
Your compilation command seems to be missing a -lpython to
load libpython.a. You are trying to embed Python, not
extend it, right?
Chris Gonnerman -- chris.gonnerman at newcenturycomputers.net
http://newcenturycomputers.net
More information about the Python-list
mailing list