This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Compiler not able to source input file

Hello,

I'm trying to compile a program that has header files within 2 folders of the current path.

Something like this,

#include <stdbool.h>
#include <stdint.h>
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_sysctl.h"
#include "inc/hw_types.h"
#include "inc/hw_uart.h"
#include "driverlib/debug.h"
#include "driverlib/interrupt.h"
#include "driverlib/uart.h"

I have header files within inc folder and driverlib folder. Each file within these folders were added to the Source group.

After going through a few threads on the forum I also tried adding my include paths at, Projects- Options for Target-c/c++ tab-Include paths {.\driverlib;.\inc}

Despite all this I'm still receiving compiler errors, such as

driverlib\lcd.c(50): error:  #5: cannot open source input file "inc/hw_memmap.h": No such file or directory

What is the best course of action?

Thank you

Parents
  • within 2 folders of the current path.

    Note that the current working directory might not be what you think it is. For a uVision project the CWD is where the uVision project files are, not where the C sourcefile is.

    And adding these
    {.\driverlib;.\inc}
    to the include search path makes no sense. This will search your header "driverlib/debug.h" using the relative filenames ".\driverlib\driverlib\debug.h" and ".\inc\driverlib\debug.h". That's surely not where it actually is, right? Your include search path should thus be {.} instead. Or if my suspicions about your working directory are correct, it may have to be {..\..\source_root} or something like that.

    In practice it's usually best to avoid path specifiers in your project-specific #include directives altogether. Bad things ensue if you ever have more than one header with the same name, in different directories of your source tree. Different source modules may then find different files while asking for the same named header, and you have rather little control over which one they'll get.

Reply
  • within 2 folders of the current path.

    Note that the current working directory might not be what you think it is. For a uVision project the CWD is where the uVision project files are, not where the C sourcefile is.

    And adding these
    {.\driverlib;.\inc}
    to the include search path makes no sense. This will search your header "driverlib/debug.h" using the relative filenames ".\driverlib\driverlib\debug.h" and ".\inc\driverlib\debug.h". That's surely not where it actually is, right? Your include search path should thus be {.} instead. Or if my suspicions about your working directory are correct, it may have to be {..\..\source_root} or something like that.

    In practice it's usually best to avoid path specifiers in your project-specific #include directives altogether. Bad things ensue if you ever have more than one header with the same name, in different directories of your source tree. Different source modules may then find different files while asking for the same named header, and you have rather little control over which one they'll get.

Children