Python.h include not found

S

Steve Doody

When I add #include <Python.h> to a
header file, GCC tells me, No such file or directory.

Am trying to learn how to combine C++ and Python.
Using SuSE 9.0 Linux, 2.4.21-231-default
GCC 3.3.1
Python 2.3.4 (Just built on the box successfully)

My problem is frustratingly simple and I am sure is because I am
ignorant of correct GCC setup and config. I am using the default SuSE
GCC setup unchanged.

I installed Python from source to /usr/local/Python-2.3.4/
The Include directory, and everything else, is there.

I have hunted through the info docs, particularly GCC, but cannot see
where I change the config to fix this... Where did I miss this?

Tried specifying the full path, #include ".../Python.h"
but then lots of related stuff breaks cos its not found...

The compile is a simple/test exercise
and works without the Python.h header line.

Appreciate any suggestions or hints as to what to look for.

Steve Doody.
SD AT ACM DOT ORG
 
T

tom_usenet

When I add #include <Python.h> to a
header file, GCC tells me, No such file or directory.

Am trying to learn how to combine C++ and Python.
Using SuSE 9.0 Linux, 2.4.21-231-default
GCC 3.3.1
Python 2.3.4 (Just built on the box successfully)

My problem is frustratingly simple and I am sure is because I am
ignorant of correct GCC setup and config. I am using the default SuSE
GCC setup unchanged.

I installed Python from source to /usr/local/Python-2.3.4/
The Include directory, and everything else, is there.

I have hunted through the info docs, particularly GCC, but cannot see
where I change the config to fix this... Where did I miss this?

Tried specifying the full path, #include ".../Python.h"
but then lots of related stuff breaks cos its not found...

The compile is a simple/test exercise
and works without the Python.h header line.

Appreciate any suggestions or hints as to what to look for.

This isn't a C++ question, but rather a question on how to use your
compiler (e.g. ask in a gcc or python group next time). But you just
need to add the include directory to your include path
(-I/usr/local/Python-2.3.4/include or whatever). You probably also
need to add the library directory and the library to the command line
to gcc too (usually done via a make file).

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top