Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to load avr/io.h header files in the gcc compiler..I'm using 12.04 version of Ubuntu..

When ever i run a AVR program this kind of error is generating

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

share|improve this question

try installing avr-libc and gcc-avr:

sudo apt-get install avr-libc gcc-avr

Then, to compile code for the AVR you need start by compiling it to an executable using: gcc-avr and then link it using avr-objcopy to create a hex file for the device:

avr-gcc -mmcu=atmegaX yourpgm.c -o yourpgm.elf

avr-objcopy -j .text -O ihex yourpgm.elf yourpgm.hex

Then, the hex file generated is the one to be installed on the device. You can use avrdude to import it. There are a lot more options that you can use for the compiler and linker, I suggest reading the man page for these tools; they are very helpful.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.