Results 1 to 3 of 3

Thread: Help with Include files

  1. #1
    Join Date
    Mar 2005
    Location
    London, UK
    Beans
    14

    Help with Include files

    Hi,
    I have apt-get build-essentials, and have gcc working with the standard Helloworld.c program.

    My problem is with #Includes for other packages.
    For example, take Python. I have apt-get the Python Dev package, and can see the Python.h is located in /usr/include/python2.4/Python.h (from memory as I am in my lunch hr at work!)

    If I add #include <Python.h> to hello.c, the compiler can't find it.

    So what is done to tell the compiler where all the includes are?
    Do I create my own Environment variable, or is their a built in solution that I haven't done or found yet.

    Thanks
    John

  2. #2
    Join Date
    Mar 2005
    Location
    Dunedin, NZ
    Beans
    559
    Distro
    Kubuntu 7.10 Gutsy Gibbon

    Re: Help with Include files

    You need to pass the include directories to the compiler on the command line. This is normally done through the makefile, but on the command line you can use -I <include dir>.

    gcc -I /usr/include/python2.4 hello.c
    I think that the -I flag might be deprecated for gcc 4, but the 3.x versions should be OK.

    Tim

  3. #3
    Join Date
    Mar 2005
    Location
    London, UK
    Beans
    14

    Re: Help with Include files - Thanks

    Hi,
    Many thanks for your comment - it pointed me in the right direction.
    In fact the old rpm I was trying to compile had Python 2.2 specified in the ./configure, but I didn't notice as it wasn't echoed in it's verbose output !
    Anyway, an edit to Python2.4 solved that problem.

    Thanks again
    John

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •