Cannot compile and link AVR program in OS X

admin

Administrator
Staff member
I am working on a Mac with Yosemite OS X and I'm trying to compile a program in C that I could then upload onto my Arduino. I am following <a href="https://balau82.wordpress.com/2011/03/29/programming-arduino-uno-in-pure-c/" rel="nofollow">a tutorial</a>.

I tried going through and reinstalling avr-gcc, but I got the same output. I tried searching for the file
Code:
crtatmega328p.o
on my system, but it is nowhere to be found and the same goes for the directory.

<pre class="lang-none prettyprint-override">
Code:
$ avr-gcc -Os -DF_CPU=16000000UL -mmcu=atmega328p -c -o Program.o Program.c
$ avr-gcc -mmcu=atmega328p Program.o -o Program
/usr/local/lib/gcc/avr/5.2.0/../../../../avr/bin/ld: cannot find crtatmega328p.o: No such file or directory

/usr/local/lib/gcc/avr/5.2.0/../../../../avr/bin/ld: cannot find -latmega328p
collect2: error: ld returned 1 exit status