fatal error: avr/io.h: No such file or directory

I searched for an answer and found some older posts but not very helpful. I'm verifying the FadeUp sketch of the DmxMaster library and I get this error message. Where should this header file supposed to be? I guess it goes along with a .cpp file, right?

I guess it goes along with a .cpp file, right?

Wrong.

I guess it goes along with a .cpp file, right?

Wrong.

Ok, but how can I solve this problem? Where is the avr/io.h file supposed to be?

In your INCLUDE path.

In your INCLUDE path.

In the DmxMaster library example there's this line

#include <DmxMaster.h>

and in DmxMaster.cpp there's this

#include <avr/io.h>

This is causing the problem. But if I find avr/io.h where should it go so the the compiler will know where to find it?

In the DmxMaster library

There you go again with the definite article, but still no link.

There you go again with the definite article, but still no link.

I've installed the DmxMaster library that you can find here
http://www.tinkerkit.com/dmxmaster-library/
in /Users/myself/Documents/Arduino/libraries on OS X. There are a couple of examples included in the library and they give this error message which comes from the .cpp file of the library. This .cpp file has this line

#include <avr/io.h>

So, how can this be solved?

I downloaded the DmxMaster library from the Tinkerkit site and put it into the libraries folder.
I opened the IDE, opened the FadeUp example, hit "compile" and got this error message

Binary sketch size: 1,538 bytes (of a 32,256 byte maximum)

(I don't have any DMX hardware, so I can't try it)
I'm sorry, I don't know a thing about Apple.

I don't know how this can be solved. There is no file io.h anywhere in the directory tree under the arduino directory on my computer. However, several other files refer to it.

There is no file io.h anywhere in the directory tree under the arduino directory on my computer.

Really?
hardware/tools/avr/avr/include/avr/io.h?

Actually, there is one, and it is here

C:......\Arduino\arduino-1.0.5\hardware\tools\avr\avr\include\avr

I don't know why the cretinous windows search fails to find it.

1 Like

Windows search can't find this file, until I reboot computer. Then it can. Windows is crap. Use Linux.

Following the discussion above I search for the io.h file and indeed found it in this path

/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/avr/include/avr

I'm on OS X, but the path is very similar to the Linux path, from what I understand from the conversation.
In DmxMaster.cpp there's this line

#include <avr/io.h>

Tried to modify it, for example like this

#include "/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/avr/include/avr/io.h"

But it still won't work. Can someone help me out with the syntax, or anything that will solve this (if you can tell), as I know very little about programming...

Continuing on this issue, I've written the following line in DmxMaster.cpp (a library installed in /Users/myself/Documents/Arduino/libraries, where the external libraries are supposed to go)

#include </Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/avr/include/avr/io.h>

And now I get this error message

In file included from /Users/alexandrosdrymonitis/Documents/Arduino/libraries/DmxMaster/DmxMaster.cpp:6:
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/avr/include/avr/io.h:99: fatal error: avr/sfr_defs.h: No such file or directory
compilation terminated.

Does this mean that Arduino can find the io.h file? In this file there are these lines

#include <avr/sfr_defs.h>
#include <avr/portpins.h>
#include <avr/common.h>
#include <avr/version.h>

and all these header files are in this path

/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/avr/include/avr

If it were only a problem of an external library it would make more sense to me, but Arduino is having trouble finding files of its own (maybe I'm mistaken here, but this is what I get).
Tried to use a relative path in io.h, like this

#include <./sfr_defs.h>

since all the header file that io.h includes are in the same directory as io.h itself, but that didn't work either.

I don't own any Apple gear, so I can't help much more, but which processor/board have you got selected?
Have you tried any of the supplied examples in the IDE?
Not being able to find io.h seems a pretty serious impediment to me.

I don't own any Apple gear, so I can't help much more, but which processor/board have you got selected?

This is quite embarrassing, I had selected the wrong board, indeed. Didn't know though that having the wrong board affects verifying the code as well. I didn't try to upload, only verify. Now I know.
Sorry for the noise and thanks a lot for the help.

No worries - it happens!
Thanks for getting back.