Pages: [1]   Go Down
Author Topic: AVR include directory  (Read 12547 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 15
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I'm trying to #include some files, e.g. avr/io.h or avr/interrupt.h but the compiler can't find them. From the Arduino documentation it says:

"The include path includes the sketch's directory, the target directory (<ARDUINO>/hardware/core/<CORE>/) and the avr include directory (<ARDUINO>/hardware/tools/avr/avr/include/), as well as any library directories (in <ARDUINO>/hardware/libraries/) which contain a header file which is included by the main sketch file."

So I've found the files I want to include, they are in (on Linux) /usr/avr/include/avr/ so I tried doing a softlink from <ArduinoHome>/hardware/tools/avr/avr to /usr/avr/include/avr.

But it still doesn't work. Any ideas?

Thanks!
Logged

London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6250
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
So I've found the files I want to include, they are in (on Linux) /usr/avr/include/avr/ so I tried doing a softlink from <ArduinoHome>/hardware/tools/avr/avr to /usr/avr/include/avr.

I don't know if that was just a typo in the post but I think they should be in:
<ArduinoHome>/hardware/tools/avr/avr/include/avr

« Last Edit: July 23, 2008, 04:38:43 am by mem » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 15
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

nope, that doesn't work either.  :-/

22: error:  avr/io.h : No such file or directory In function 'void setup()':

[root@wintermute arduino-0010]# ls -l hardware/tools/avr/avr/include/avr/io.h
-rw-r--r-- 1 root root 11499 2007-07-18 10:04 hardware/tools/avr/avr/include/avr/io.h
[root@wintermute arduino-0010]#


Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 15
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can someone with a working IDE running on Linux please run a command for me and post the outcome?

Can you change to your arduino directory (the one where you can see examples, hardware, lib, etc), and run the following:

find . -name io.h

Thanks!
Jules.
Logged

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 11
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What distribution are you on?  How did you install avr-gcc?  In theory, avr-gcc should be able to find its own include files in their default location, regardless of your working path.  
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 14
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Folks,
I am having trouble including libraries too, but with (i think) a different problem.
Specifically, I am trying to experiment with sleep modes, but the examples specify
#include <avr/sleep.h> without any link to the actual library to include.
the link from the arduino.cc sleep example (http://www.arduino.cc/playground/Learning/ArduinoSleepCode)
takes one to:
http://www.nongnu.org/avr-libc/user-manual/group__avr__sleep.html
which links to:
http://www.nongnu.org/avr-libc/user-manual/sleep_8h.html
which is an HTML page with explanations of various details about AVRs and sleep modes, but for the life of me, I can't find a link to or a copy of an actual library that I can put in my libraries folder and use.
In a larger sense, I am having this problem with other libraries too, I see some code or example code that someone has posted, and they use #include statements for libraries that are not part of the default Arduino IDE, and no link to the library, no library enclosure linked for download, etc. Is it just me? Is there some repository of libraries that everyone else somehow knows about, or am I missing something?

any help is appreciated.
thanks
Logged

Dyess AFB, Tx
Offline Offline
Newbie
*
Karma: 0
Posts: 48
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

zzpza:
Is your code "#include avr/io.h" or "#include io.h"?  I would think that if the environment sets the avr directory as a default location, then telling to check the avr directory would return as the file not being there.  I don't know if this is the case, but worth a try.

-Jon
Logged

Cheltenham, England
Offline Offline
Newbie
*
Karma: 0
Posts: 21
Arduino Fiend
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all,

I've just encountered a problem similar to this (on my fresh install of Debian 5/Lenny) and fixed it by installing the following:

gcc
gcc-avr
avr-libc
avrprog
avrdude

Some of those probably don't need to be installed but I just installed the lot and it seems to work.

Regards,
Tim
Logged

Wuppertal/Germany
Offline Offline
God Member
*****
Karma: 1
Posts: 895
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I've just encountered a problem similar to this (on my fresh install of Debian 5/Lenny) and fixed it by installing the following:

gcc
gcc-avr
avr-libc
avrprog
avrdude

Some of those probably don't need to be installed but I just installed the lot and it seems to work.
You don't need avrprog, but all the others must be installed to run the IDE on Linux
Eberhard
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 1
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I had the same problem and it was drivin me crazy. Then, for some reason I removed the spaces before and after the pathnames, ie instead of #include < avr/io.h > I tried #include <avr.io.h> and the problem went away! I hope this helps  smiley-wink
danno
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 132
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Just to fill out an old thread with another answer:

If you are doing this in a file that is NOT your main one, then add the same #include to your main file (the one with loop in it).  Amazingly the include file suddenly is found in all files.  Total guess but I think that the Arduino IDE is trying to be helpful by scanning your sketch and automatically adding -I lines to the compile.  But its not doing so for all .c and .h in your sketch so it ends up outsmarting itself and confusing mere mortals like you and I.  :-)
Logged

Pages: [1]   Go Up
Jump to: