LPCXpresso directories issues

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPCXpresso directories issues

883 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by fjrg76 on Mon Nov 12 22:14:21 MST 2012
Hi

I already know this is a silly question, and although I've tried different approaches, I still have problems compiling source code (*.c) outside the /src directory.

Say I have this directory hierarchy:

[FONT=Courier New]/myProject
  /src
    main.c
  /drivers
    spi.c
    spi.h[/FONT]

and in the project settings I have this in "Includes":

"${workspace_loc:/${ProjName}/drivers}"
"../drivers"

(it's redundant, but I did it to be shure it works)

The compiler is able to find the .h files; however, I got this error from the linker

[I]\myWS\LPC1227_Board\Debug/../src/main.c:268: undefined reference to `spi_Init'[/I]

It gets worst when the files are outside my project and belongs to another project, for example, when linking against the FreeRTOS example.


Do I need to set the source's code path into the "Libraries" setting? It seems it's not enough with pats in "Includes".

Any ideas? What am I missing?


Thank you!!
0 Kudos
Reply
3 Replies

869 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by fjrg76 on Tue Nov 13 18:45:19 MST 2012
I was missing one option inside Eclipse so that the linker finds the source code (.c files)

[B]Project (be shure you select the correct one) -> Properties -> C/C++ General -> Paths and symbols -> Source location tab -> Add folder -> Choose the folder where your source files reside -> Ok -> Project -> Clean -> Project -> Build[/B]
0 Kudos
Reply

869 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by fjrg76 on Tue Nov 13 10:59:03 MST 2012
Thank you, but is that necessary just for adding a source code inside the same project? I did it and it didn't work :D

As far as I read in the article that procedure is for creating a library and then share it among other projects.

I made a little project for the FreeRTOS and a LPC1114 in a previous LPCXpresso release some months ago (the FreeRTOS directory is inside the project), then I added it to my actual workspace and it did compile. So, in a new project inside the same workspace I created the same files hierarchy than that of the LPC114 project, but for the LPC1227. I also added the paths as mentioned earlier in "Include settings" (and BTW, there is nothing related to FreeRTOS in "Library settings"), just the same as the LPC1114 project, but for a reason the linker throws the error that it cannot find the references to functions in FreeRTOS.

Then I adapted the LPC1114 project for my LPC1227 (changing references from "LPC11xx.h" to "LPC122x.h" and paths, but keeping the directory structure) and it compiled.

Now my LPC1227 project is up and running, but I would like to know what I missing so one project compiles and links, and the other one don't.
0 Kudos
Reply

869 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Tue Nov 13 02:22:17 MST 2012
Linker errors are nothing to do with include paths, or where your source is located. You need to provide the linker with the path to your library.

Searching the Code Red support pages often helps...
http://support.code-red-tech.com/CodeRedWiki/LibraryProjects
0 Kudos
Reply