Find the answer to your Linux question:
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.
  1. #1
    Just Joined! rm-rf's Avatar
    Join Date
    Mar 2011
    Posts
    85

    Question Getting Arduino compiler erros


    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 $^
    
    main:  arm.cpp
            $(CMB)
    and the following program:
    Code:
    void setup()
    {
            pinMode(3, OUTPUT);
    }
    
    void loop()
    {
            digitalWrite(3, HIGH);
    }
    It worked fine with the compile automagically defining everything on windows, yet I keep getting this error:
    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

  2. #2
    Linux Newbie
    Join Date
    Mar 2010
    Posts
    152
    Quote Originally Posted by rm-rf View Post
    Code:
    void setup()
    {
            pinMode(3, OUTPUT);
    }
    Code:
    arm.cpp:4:13: error: 'OUTPUT' was not declared in this scope
    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"):

    Code:
    #include <header.h>
    You just need to find out which header(s) - look at the definition of pinMode() etc. and it should tell you.
    Programming and other random guff: cat /dev/thoughts > blogspot.com (previously prognix.blogspot.com)

  3. #3
    Just Joined! rm-rf's Avatar
    Join Date
    Mar 2011
    Posts
    85
    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?

  4. #4
    Just Joined! rm-rf's Avatar
    Join Date
    Mar 2011
    Posts
    85
    D'oh. Just found out what the problem is. I just needed to go here: Arduino Playground - CommandLine and follow the instructions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •