Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 years ago

Includes

Hello!

I include some headers in one c-file of a project.

These headers are in other directories as the c-file.

I can't use absolute paths to include the header files,

because the headers include files in there own directory.

So I open in system properties "C/C++ Inclde Paths & Symbols".

Here I add via button "Add External Include Path..." the

directory of the header-files and their includes.

But when I compile again the compiler can't still find headers.

What is going wrong?

Bye, Lothar.

6 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi Mountain!

    Sorry, I didn't mention that I don't want to use relative paths too.

    I'm searching for a possibility to set include paths for the compiler

    for a project in Nios II.

    Bye, Lothar.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by maico@Oct 11 2005, 07:39 AM

    hi mountain!

    sorry, i didn't mention that i don't want to use relative paths too.

    i'm searching for a possibility to set include paths for the compiler

    for a project in nios ii.

    bye, lothar.

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=10295)

    --- quote end ---

    --- Quote End ---

    Edit your Makefile and add -I<path-to-include-dir> to your CFGLAGS (Note: -I is a capital i not an L).

    After that you can include the files with# include <file>

    The path you give with the -I flag can be either absolute or relative.

    Hop this helps
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I ran into the same problem. The project properties setting doesn&#39;t seem to do anything with regards to the path settings.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi Mountain!

    My makefile is:

    ifneq ($(KERNELRELEASE),)#  kbuild part of makefile
    obj-m := hello.o
    else#  Normal Makefile
    KERNEL_PLUGIN:= /cygdrive/c/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2linux.kernel_1.4.0
    KERNELDIR := $(KERNEL_PLUGIN)/linux-2.6.x
    BUILDDIR := /cygdrive/c/Entwicklung/NIOS/workspace3/hello_driver_linux
    all::
        $(MAKE) -C $(KERNELDIR) M=`pwd` O=$(BUILDDIR) -o $@
    endif

    And it&#39;s making a lot of compiler errors, which caused by path problems.

    Bye, Lothar.