how to include header files?

Sysprogs forums Forums VisualGDB how to include header files?

This topic contains 3 replies, has 2 voices, and was last updated by  support 8 years ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #494

    Anonymous
    Participant

    Simply question, but I am somewhat new to toolchains, etc.

    How do I include a path to the header files I need for my project? Not the default ones like but, say, “python.h”? Can’t figure out where that include path should go.

    In my case because I can’t get the remote build to work (see my other post regarding the Finish button that won’t click) I am building locally with a cross compiler. Can do the tutorial “hello world” just fine, but can’t figure out how to be able to include a header file “python.h” in that source code.

    And I will ultimately have to do the same with lib.

    Where is this configured? Greatly appreciate the help.

    #2224

    support
    Keymaster

    Hi,

    When using a cross-compiler for Raspberry you need to copy any additional include files from the /usr/include on the Raspberry box to C:SysGCCraspberryarm-linux-gnueabihfsysrootusrinclude. Then the toolchain and the IntelliSense will recognize them correctly.

    You can use SmarTTY, our free SSH client to quickly download the entire include directory into the toolchain directory.

    #2225

    Anonymous
    Participant

    Have spent hours and hours on this…

    Copied the header files to where you indicated, also the libs.

    But simply will not find them. Always get:

    VisualGDB remote project path: /tmp/VisualGDB/c/temp/Projects/LinuxProject1/example
    Sending 1 updated source files to build machine…
    make CONFIG=DEBUG
    g++ -ggdb -ffunction-sections -ffunction-sections -O0 -DDEBUG -c example.cpp -o Debug/example.o -MD -MF Debug/example.dep
    C:tempProjectsLinuxProject1exampleexample.cpp(2,20): fatal error : Python.h: No such file or directory
    compilation terminated.
    make: *** [Debug/example.o] Error 1

    Confirmed, reconfirmed, everything.

    And here is the kicker: I have two projects, one a shared library and the other the hello world exe. In the hello world exe it DOES find and use python.h and compiled correctly. But although the shared library project is configured identically, it does NOT find the python.h file even though it is in the directory you suggested.

    Really not sure what to do…is it confusing the visual studio win32 directories and trying them? Any profound difference between exe and shared library in terms of how they use includes?

    #2226

    support
    Keymaster

    Hi,

    Normally the Python include files are located in a Python-version subdirectory (e.g. /usr/include/python2.7/Python.h). Thus you need to add it to additional include path.
    This can be done by setting the INCLUDE_DIRS variable inside flags.mak. E.g.:

    INCLUDE_DIRS := /usr/include/python2.7

    If you are using a cross-compiler, the path will be:

    CROSS_SYSROOT := C:/SysGCC/raspberry/arm-linux-gnueabihf/sysroot
    INCLUDE_DIRS := $(CROSS_SYSROOT)/usr/include/python2.7

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.