[C++-sig] Extansion compilation in Linux

François Duranleau duranlef at iro.umontreal.ca
Thu Oct 4 16:45:27 CEST 2007


On Wed, 3 Oct 2007, Paul Vicenti wrote:

> Hi,
> I'm moving a project from Windows and I'm having problems to compile. I get a:
> 'undefined reference to 'PyThreadState_Get' and whatever I use in my
> code of Python library.
>
> In windows I include Python.h and it links with python library to
> resolve all symbols.
> Here, it looks that the include file is found (otherwise, I expect
> 'cannot open file Python.h') but the library seems not to be linked.
>
> Any help for this?

AFAIK, there is no auto-link feature with gcc. You need to tell it 
explicitly to link with the Python library by adding the swithc 
-lpython2.x (where x is the version you are using).

-- 
Francois Duranleau



More information about the Cplusplus-sig mailing list