Help using 16X2 LCD with Arduino

Hi all,
I’m new here so please be gentle ;-

I’m trying to use a 16X2 parallel LCD module (Parallax 603-00006) with an Arduino Duemilanove (Atmega 328) but I get a bunch of errors when I try to build using sample code from the following page: (LCD (Liquid Crystal Display) -

I noticed that if I add the line #include <arduino.h> but I read through the LiquidCrystal.h library and the Arduino.h library is included inside LiquidCrystal.h, which makes me think that maybe platformIO isn’t including the LiquidCrystal.h file like I want it to???
Anyway when I do a build with both the header files mentioned above I get a single error that says

"src\main.c: In function 'loop':
src\main.c:28:3: error: 'lcd' undeclared (first use in this function)
lcd.print(" Hello, World!!"); //Output " Hello, World!!" on the first line of the LCD
scons: *** [.pioenvs\diecimilaatmega328\src\main.o] Error 1
 [ ERROR ] Took 0.69 seconds"

It apparently has an issue with the line lcd.print(" Hello, World!!"); but I have no idea what to do to fix it. Can anyone point me in the right direction?

My code is copied from the above page and is shown here:

#include <Arduino.h>
#include <LiquidCrystal.h> //Import the LCD library
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); /*Initialize the LCD and
                                        tell it which pins is
                                        to be used for communicating*/

//Global Var
#define contra 9 //Define the pin that controls the contrast of the screen
#define bri 10 //Define the pin the controls the brightness of the screen
//Both pins are PWM so you can analogWrite to them and have them output a variable value

void setup() {//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  // put your setup code here, to run once:
  lcd.begin(16, 2); //Tell the LCD that it is a 16x2 LCD
  pinMode(contra, OUTPUT); //set pin 9 to OUTPUT
  pinMode(bri, OUTPUT); //Set pin 10 to OUTPUT
  //pinMode-ing OUTPUT makes the specified pin output power
  digitalWrite(contra, LOW); /*outputs no power to the contrast pin.
                            this lets you see the words*/
  analogWrite(bri, 255); //Outputs full power to the screen brightness LED

void loop() {//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  // put your main code here, to run repeatedly:
  lcd.print(" Hello, World!!"); //Output " Hello, World!!" on the first line of the LCD
  lcd.setCursor(0, 1); /*Set the (invisible) cursor on the first place second row of the LCD.
                        Cursor values are 0-indexed, 0 would the be the first place.
                        The cursor coordinates are X,Y coordinates.*/
  lcd.print("16x2 LCD Screen");
  delay(1000); //Wait a second
  for (int l = 0; l < 16; l++) { //For loop. Repeating 16 times
    lcd.scrollDisplayRight(); //Scroll whole screen to the right once
    delay(90); //Slight delay for animation
  for (int l = 0; l < 16; l++)
  for (int l = 51; l > -1; l--) { //Repeating 51 times
    analogWrite(bri, l * 5);
  digitalWrite(bri, HIGH);
  for (int l = 0; l < 51; l++) { //Repeating 51 times
    analogWrite(contra, l * 5);
  lcd.setCursor(0, 0);

Hi @Patrick!
Please rename main.c to main.cpp
Arduino is C++ based framework.

@valeros thank you! I’m amazed that you answered only a minute or two after I posted my question. Your information solved the problem, the code compiled and uploaded to my board and functions fully.
I used ansi C in college (20 years ago) and never did any C++ programming, assumed that ansi C was a subset of C++ and also assumed the file suffix didn’t make a difference.
Thanks again.