how to include files?

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

how to include files?

951 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by zeal007 on Mon Sep 06 01:47:50 MST 2010
[B]good day everyone,[/B]

[B]How can we add files in LPCXpresso so that it will be included in the Build process of the project?[/B]

[B]And/Or how can we add files too, so that it will be part of the compiler options?[/B]

[B]thanks...[/B]
0 Kudos
Reply
3 Replies

928 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Tue Sep 07 00:53:11 MST 2010
To include a header file stored in the same directory as your source, simply use:

[FONT=Courier New][SIZE=1]#include "header.h"[/SIZE][/FONT]

If you header file is stored in a different directory toyour source code, for example in the "inc" subdirectory of the project then you can either use the following in your source:

[FONT=Courier New][SIZE=1]#include "../header.h"[/SIZE][/FONT]

or leave the include without the relative path information and instead modify the project settings:

C/C++ Build -> MCU C Compiler -> Directories

and add [FONT=Courier New][SIZE=1]"../inc"[/SIZE][/FONT] to the include paths. You can also browse to the directory you want to use for include files, but be warned that this can cause problems, for example, if you change the name of the project.

To include headers (and code) from library projects, please see:
[B]Using library projects from your own projects[/B]
http://lpcxpresso.code-red-tech.com/LPCXpresso/node/22

I would also suggest that you also take a look at the way the example projects are set up. Many of these use both local include files, and also include files from library projects (such as the CMSIS one).

Regards,
CodeRedSupport
0 Kudos
Reply

928 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by zeal007 on Mon Sep 06 17:25:44 MST 2010
hmmm, including files for my project. But you can share too, how to include existing project to another main project.

thanks...
0 Kudos
Reply

928 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by renan on Mon Sep 06 04:12:20 MST 2010
Do you mean including files in your project?
Or do you mean using another project files as includes to your main project?

Renan
0 Kudos
Reply