kembed

LPCXpresso: Unable to add a header file (undefined reference error)

Discussion created by kembed on Mar 16, 2017
Latest reply on Dec 14, 2017 by Somdutt Acharya

Hi!

 

I am trying to separate led code in a different file and I am facing following issues:

 

Issue #1

   I Created a new folder by

   Right clicking project -> New -> Folder -> Folder name = led.

   Now when I try to  create a header file and source file by 

   Right clicking project -> New -> Header File/Source File, I could  not find "led" folder which I just created. Why is led    folder not there?

 

Issue #2 

   If I create a header file and source file by 

   Right clicking project -> New -> File -> File name = led.h and File name = led.c, and #include "led.h" in my    hello_world_core1.c file, the program is not compiling and gives me the following error:

   

fatal error: led.h: No such file or directory hello_world_core1.c /hello_world_cm0plus/source line 44 C/C++ Problem   

   If I manually include led.h header file in the Include files (-include) by

   Right clicking project -> Properties -> C/C++ Build -> Setting -> MCU C Compiler -> Include files (-include)

   -> ${workspace_loc:/${ProjName}/led/led.h}

   I get the same error

fatal error: led.h: No such file or directory hello_world_core1.c /hello_world_cm0plus/source line 44 C/C++ Problem

   Now if I manually include led.h header file in the Include Paths (-l) by

   Right clicking project -> Properties -> C/C++ Build -> Setting -> MCU C Compiler -> Include paths (-l)

   -> ${workspace_loc:/${ProjName}/led}

   the previous fatal error disappears and but it gives me a new error about a function UpdateLED() which I am calling from    led.c.

   

undefined reference to `UpdateLED' hello_world_core1.c /hello_world_cm0plus/source line 119 C/C++ Problem

 

Any help would be highly appreciated!

 

Thanks

Outcomes