Question on adding header file to Atmel Studio 6.2

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So, i know how to include files in individual projects, but seeing as i made these headers to be re-used, it seems a bit pointless having to add them to each project folder.

Basically:

What i do now is move the header to the project folder and do:

#include "hdrnme.h"

What i want to be able to do is simply doing something like:

#include <myhdr/hdrnme.h>

without moving files around, like you would when adding for example <util/delay.h>

So yes, how would i make a header file able to be included in such a way?
.

.

.

.

*EDIT*
Figured something out, it may not be the best solution though; I need administrator permission to move the file into the folder, and as such have to save new headers elsewhere and manually move them to the folder.

After looking around for a bit, i moved my custom header folder to and am putting my header files into said folder (named it phlib)

C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.1061\avr8-gnu-toolchain\avr\include\phlib\

I can now access my own headers in any project using

#include <phlib/hdrnme.h>

but the method seems.. unintended, so if anyone has a better way, shoot :)

This topic has a solution.

Last Edited: Sat. May 16, 2015 - 05:16 PM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Find the "util/delay.h" file on your disk.   e.g. by following the path from your AS6.2 installation.

On this Vista-32 laptop :

c:\program files\atmel\atmel toolchain\avr8 gcc\native\3.4.1056\avr8-gnu-toolchain\lib\gcc\avr\4.8.1\include

 

Copy your "mydir" to the same directory.    You will need Root privileges.

 

Note that a new AS6 release might install a 'newer' GCC.    So you would have to copy your "mydir" to the new system directory.

 

The other way of doing things is to create your own Project Template.    Then every project that uses the template would have your "mydir".

 

Personally,   I think it is a bad idea to use <system_header.h> search rules for "user_header.h" files.    But hey-ho,   you can do what you like.

 

David.