Pages: [1]   Go Down
Author Topic: Problems with includes using Eclipse as IDE  (Read 4071 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 8
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

I am trying to use my Arduino with the Eclipse IDE but somehow I am not able to use the command #include <LiquidCrystal.h>

A simple example like Blink works just fine, but if I try to compile the following little code, I got an error.
Code:
#include "WProgram.h"

#include <LiquidCrystal.h>

int main(void) {

  /* Must call init for arduino to work properly */
  init();

  /****************************/
  /* Add your setup code here */
  /****************************/
  pinMode(13, OUTPUT);
  LiquidCrystal lcd(7, 5, 4, 3, 2, 1);

  for (;;) {

    /****************************/
    /*** write main loop here ***/
    /****************************/
digitalWrite(13, HIGH);   // set the LED on
delay(200);              // wait for a second
digitalWrite(13, LOW);    // set the LED off
delay(200);              // wait for a second

  } // end for

} // end main

As Error I get
Quote
expected '=', ',', ';', 'asm' or '__attribute__' before 'lcd'

Has anyone any idea what is going on?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 8
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

From looking at the syntax for LiquidCrystal() it looks like your line should be:

LiquidCrystal(7, 5, 4, 3, 2, 1);

instead of:

LiquidCrystal lcd(7, 5, 4, 3, 2, 1);
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Nope, this should be correct. Works fine with the Arduino IDE tough...

Any other idea?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 8
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

is the file main.c or main.cpp ? My first though was that it looks like the errors I get if I try to compile a C++ file with the C compiler.

If that's not it someone more familiar will have to help you out.
Logged

Pages: [1]   Go Up
Jump to: