Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: includes search path for GCC Compiler?

  1. #1
    Senior Member
    Join Date
    Jul 2013

    Question includes search path for GCC Compiler?

    I am using make utility to compile blinky.c. The file specifies include files.
    #include "usb_debug_only.h"
    #include "print.h"
    I have a copy of these include files in each directory containing a Makefile.
    It works, but there must a way to compile with just one copy in a search path, rather than a copy in each Makefile directory.
    Something like moving a copy of the include files into
    What's the best way to include "usb_debug_only.h" and "print.h" files for make and Teensy 2.0 on Windows 7?

    Thank you.

    Blinky source code:
    The GCC Compiler and Tools Getting Started tutorial
    Last edited by wolfv; 09-08-2013 at 05:19 AM.

  2. #2
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Ayer Massachussetts
    Note, that #include "file.h" is meant to be a local file, and #include <file.h> is meant for global files.

    The options for the 4.3.x compiler shipped with the Arduino AVR IDE (and hence Teensy 2.0/2.0++) are at: Mostly the same options are for 4.7.x used for Teensy 3.0:

    In addition there are environment variables that the compiler uses: and
    Last edited by MichaelMeissner; 09-08-2013 at 06:44 AM.

  3. #3
    Senior Member
    Join Date
    Aug 2013
    Gothenburg, Sweden
    You must add an include path directory specification to the the command line sent to the compiler.
    The syntax is : -I {Path to directory containing include files}
    Optional extras to the compiler are usually in a variable called CFLAGS or similar, you add simething like

    CFLAGS = ..... /* heres a lot of other stuff */.... -I /home/nicke/arbete/arduino-1.0.5/hardware/teensy/cores

  4. #4
    Senior Member
    Join Date
    Jul 2013
    Thanks Micheal and mlu. The blinky Makefile from comes with macro's that insert -I, it worked well.

    Here are the lines from the blinky Makefile
    # List any extra include directories here.
    CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))

Tags for this Thread

Posting Permissions

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