Skip to main content
edited tags
Link
VE7JRO
  • 2.5k
  • 19
  • 28
  • 31
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Source Link

avr/io.h No such file or directory error when compiling using avr-gcc

I am trying to use the atmega328p as standalone microchip and program it. I ama using an Arduino Uno as ISP. I have written a simple program to test it however when I try to compile it using

avr-gcc -mmcu=atmega328p -o main.out main.c

I get the error:

main.c:1:20: fatal error: avr/io.h: No such file or directory
compilation terminated.

I am running OpenSUSE Leap 42.3 and i have installed avr-gcc, avr-libc.

My code:

#include <avr/io.h>                                                                                                                                                                    

int main() {
    DDRB = 1;
    PORTB = 1;
}

Thank you in advance!