"#include" lines somehow not working

Hi guys.
Noob question.
I have had a poke around through the forums and the user manual but have obviously missed something.
I have taken code from the analog1 example and the button example and the motor example, deleted what I thought I didn’t need, meshed it all together in what I thought should be some sort of order and then hit the build button in AVR studio 4. not surprisingly for my first attempt there were/are many errors. Most of these do not worry me as they are easy fixed and obvious mistakes. however there are some at the top of the list of errors that make me think that I am failing to access the correct (any)libraries, ie the #include lines aren’t working. (See errors below) At first I thought it may have been the way I installed the “bundle” in that I elected where I wanted the files to go. So I uninstalled everything and then reinstalled the bundle letting the installer decide where to put things. Same result. I tried using the configuration settings and linking libraries with objects. Same result. I tried in both avr-gcc and win avr. Same result. the nearest I got in the forums was a guy who was programming in c and not c++ or something like that, he was directed to section seven of the programming manual (using pololu libraries for your own projects) Where it mentioned including the “#include” lines. No help there unless I have missed something (likely). The code Is simple enough. I am trying to get an orangutan to control an linear actuator according to buttons pushed and display its position on the lcd. Its position is fed back via an attatched pot. To begin with I thought I would use the code in the “Analog” example that uses the orangutans own pot just to test the theory. Alas I have not got that far as it wont build or compile.

Code is as follows

#include "pololu/OrangutanLEDs.h"
#include "pololu/OrangutanAnalog.h"
#include "pololu/OrangutanMotors.h"

   


  
int main()                    
 { while(1)  
  { 
    // note that the following line could also be accomplished with: 
    // int pot = analogRead(7); 
    int pot = read_trimpot();  // determine the trimpot position 
      
     
    lcd_goto_xy(0, 0); 
    print("door=");
int opening = (pot-243*2) 
    print_long(opening),("mm);               // print the trim pot position (0 - 1023) 
    print("  ");              // overwrite any left over digits 
      
    } 
    
     
  while(1) 
  { int motor direction
    
    // wait for either the top or bottom buttons to be pressed 
    // store the value of the pressed button in the variable 'button' 
    unsigned char button = wait_for_button_press(TOP_BUTTON | BOTTOM_BUTTON); 
    
    if (button == TOP_BUTTON) 
delay_ms(25);
     motor direction = 512
      set_motors(motor direction, 0);  // runs motor forward at top speed
// turn green LED on when motors are spinning forward 
    if (motor direction > 0) 
      green_led(1);
    else
motor direction = -512
      set_motors(motor direction, 0);  // runs motor backward at top speed 
    ;  
    // turn red LED on when motors are spinning in reverse 
    if (motor direction < 0) 
      red_led(1); 
wait_for_button_release(button)// wait for that button to be released  
     
    // all LEDs off 
    red_led(0); 
    green_led(0); 
     
    
    delay_ms(100); 
  } 
}

}

Errors are as follows

Build started 23.3.2012 at 18:39:31
d  -c  ../deletethis.c

In file included from ../deletethis.c:3:
C:\Documents and Settings\ My Documents\deletethis\..\..\..\..\libpololu-avr/pololu/OrangutanLEDs.h:1:41: error: OrangutanLEDs/OrangutanLEDs.h: No such file or directory
In file included from ../deletethis.c:4:
C:\Documents and Settings\ My Documents\deletethis\..\..\..\..\libpololu-avr/pololu/OrangutanAnalog.h:1:45: error: OrangutanAnalog/OrangutanAnalog.h: No such file or directory
In file included from ../deletethis.c:5:
C:\Documents and Settings\ My Documents\deletethis\..\..\..\..\libpololu-avr/pololu/OrangutanMotors.h:1:45: error: OrangutanMotors/OrangutanMotors.h: No such file or directory
../deletethis.c:25: error: expected identifier or '(' before '{' token
../deletethis.c: In function 'main':
../deletethis.c:39: warning: implicit declaration of function 'read_trimpot'
../deletethis.c:42: warning: implicit declaration of function 'lcd_goto_xy'
../deletethis.c:43: warning: implicit declaration of function 'print'
../deletethis.c:45: error: expected ',' or ';' before 'print_long'
../deletethis.c:45:26: warning: missing terminating " character
../deletethis.c:45: error: missing terminating " character
../deletethis.c:44: warning: unused variable 'opening'
../deletethis.c:52: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'direction'
../deletethis.c:52: error: 'direction' undeclared (first use in this function)
../deletethis.c:52: error: (Each undeclared identifier is reported only once
../deletethis.c:52: error: for each function it appears in.)
../deletethis.c:56: error: expected ';' before 'unsigned'
../deletethis.c:58: error: 'button' undeclared (first use in this function)
../deletethis.c:58: error: 'TOP_BUTTON' undeclared (first use in this function)
../deletethis.c:59: warning: implicit declaration of function 'delay_ms'
../deletethis.c:60: error: 'motor' undeclared (first use in this function)
../deletethis.c:60: error: expected ';' before 'direction'
../deletethis.c:63: error: expected ')' before 'direction'
../deletethis.c:64: warning: implicit declaration of function 'green_led'
../deletethis.c:66: error: expected ';' before 'direction'
../deletethis.c:70: error: expected ')' before 'direction'
../deletethis.c:71: warning: implicit declaration of function 'red_led'
../deletethis.c:72: warning: implicit declaration of function 'wait_for_button_release'
../deletethis.c:75: error: expected ';' before 'red_led'
../deletethis.c: At top level:
../deletethis.c:83: error: expected identifier or '(' before '}' token
make: *** [deletethis.o] Error 1
Build failed with 20 errors and 9 warnings...

I’m pretty sure ive missed something that would be obvious to a headless chicken I’m just not sure what it is.
Any help would be greatly appreciated.
cheers

Hello.

This is the first error message you got from the compiler. It means that it is trying to do your ’ #include “pololu/OrangutanLEDs.h” ’ line, but it can’t find the file. Please try using angle brackets instead of quotes:

#include <pololu/OrangutanLEDs.h>

In general it’s a good idea to focus on the first error message because it’s easier to understand why the error happened and fixing it will often fix later error messages.

–David

thanks david.
yup tried that. any other ideas?

Did the error messages change at all after you replaced the quotes with angle brackets? Maybe you should just post your entire build output again.

We provide example AVR Studio projects with the library. If you open one of those and build it, does it work?

–David

thanks david
after manby months of not being able to return to this i now have some spare time and i have eventually figured out that it was just a bad bad bad misbehaving computer. new computer with a fresh download made life so much more pleasant. now then onwards and upwards
cheers

Both these lines contain syntax errors that will cause your code to not compile or run.
Each invocation of print functions need to be a separate call; you can’t “chain” arguments on the outside of parentheses.
Each statement should be terminated by a semicolon.
Variables cannot have spaces in their names. Use underscores instead.