Results 1 to 4 of 4
Hi I've been trying to program my arduino uno with this Makefile:
Code:
#! /usr/bin/make
C_OPTS=-I ./include
CC=avr-gcc $(C_OPTS)
CMP=$(CC) -c $^-o $@
CMB=$(CC) $^ -o $@
upload: main
avrdude ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 12-20-2012 #1Just Joined!
- Join Date
- Mar 2011
- Posts
- 67
Getting Arduino compiler erros
Hi I've been trying to program my arduino uno with this Makefile:
and the following program:Code:#! /usr/bin/make C_OPTS=-I ./include CC=avr-gcc $(C_OPTS) CMP=$(CC) -c $^-o $@ CMB=$(CC) $^ -o $@ upload: main avrdude $^ main: arm.cpp $(CMB)
It worked fine with the compile automagically defining everything on windows, yet I keep getting this error:Code:void setup() { pinMode(3, OUTPUT); } void loop() { digitalWrite(3, HIGH); }
Code:avr-gcc -I ./include arm.cpp -o main arm.cpp: In function 'void setup()': arm.cpp:4:13: error: 'OUTPUT' was not declared in this scope arm.cpp:4:19: error: 'pinMode' was not declared in this scope arm.cpp: In function 'void loop()': arm.cpp:9:18: error: 'HIGH' was not declared in this scope arm.cpp:9:22: error: 'digitalWrite' was not declared in this scope make: *** [main] Error 1 shell returned 2
- 12-21-2012 #2Linux Newbie
- Join Date
- Mar 2010
- Posts
- 152
The compiler hasn't seen "OUTPUT", "pinMode" etc. before, and so doesn't know what it is/where to find it/what to do with them. They'll be in a header file that you need to include, which you do like (e.g. to include "header.h"):
You just need to find out which header(s) - look at the definition of pinMode() etc. and it should tell you.Code:#include <header.h>
Programming and other random guff: cat /dev/thoughts > blogspot.com (previously prognix.blogspot.com)
- 12-21-2012 #3Just Joined!
- Join Date
- Mar 2011
- Posts
- 67
Yes I already kne that. Like I said: on windows I don't need to #include anything, it's just predefined. So my question is what headers do I include?
- 12-23-2012 #4Just Joined!
- Join Date
- Mar 2011
- Posts
- 67
D'oh. Just found out what the problem is. I just needed to go here: Arduino Playground - CommandLine and follow the instructions.


Reply With Quote

