Embedded Python Linking Problem

Jp Calderone exarkun at intarweb.us
Tue Feb 25 23:09:35 CET 2003

On Tue, Feb 25, 2003 at 01:16:42PM -0800, Ian Terrell wrote:
> I'm experimenting with embedding Python in C++ programs as explained
> in http://www.python.org/doc/current/ext/embedding.html.  I'm having
> some trouble linking, however.
> [snip]
> It compiles cleanly, but can't resolve linking:
> $ g++ hello.cc -o hello
> /tmp/ccGyP0Vj.o: In function `main':
> /tmp/ccGyP0Vj.o(.text+0x11): undefined reference to `Py_Initialize'
> /tmp/ccGyP0Vj.o(.text+0x1e): undefined reference to
> `PyRun_SimpleString'
> /tmp/ccGyP0Vj.o(.text+0x26): undefined reference to `Py_Finalize'
> collect2: ld returned 1 exit status

  Try:  g++ hello.cc -o hello -L/usr/lib/python2.2/config/ -lpython2.2


A sad spectacle.  If they be inhabited, what a scope for misery 
and folly.  If they be not inhabited, what a waste of space.
                -- Thomas Carlyle, looking at the stars
 up 17 days, 2:29, 5 users, load average: 0.17, 0.25, 0.26
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20030225/ec9e92a4/attachment.sig>

More information about the Python-list mailing list