[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie compiler/pathname/library issue

From: Paul Pluzhnikov
Subject: Re: Newbie compiler/pathname/library issue
Date: Fri, 12 Jan 2007 15:12:02 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)

"marieblasdell" <> writes:

> I changed my program to:
> #include </usr/include/python2.3/Python.h>

That's the wrong way to fix it.
The right way is to keep

  #include <Python.h>

and to add -I/usr/include/python2.3 to your compile lines.

> I assume there's probably a better way than including the pathname in
> the include, but it recognized Python.h, but still found undefined
> references to Py_Initialize and Finalize.
> I tried compiling with the command:
> g++ -L/usr/include/python2.3 test.cpp
> g++ -L/usr/include/python2.3 -lpython2.3 test.cpp
> g++ -L/usr/lib/python2.3 -lpython2.3 test.cpp

These are all incorrect, although the last one should have worked
if is installed in default location. 

Perhaps you should actually read the manuals and try to understand
what all the options mean?

> I'd appreciate any advice that'd point me in the right direction. The
> instructions for embedding Python that I've found just say something
> along the lines of: 'Let your compiler know the pathname and where to
> find the libraries'....without any specifics.

Start by "locate" which should give you the location
of the library you must link with (if it is installed at all).

Assuming locate gives you:


Correct command would be:

  g++ -I/usr/include/python2.3 test.cpp -L/foo/bar/baz -lpython2.3

In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]