Old project from 2007 won't compile any more

Ok, so we are all understanding what is going on.

My sketch

/*
      For laptop:  Uno on com port 3.  Left side USB front.
*/

#define version_ "100"

#define phi_2_shield
#include <LiquidCrystal.h>
#include <Wire.h>
#include <stdio.h>
#include <avr/pgmspace.h>
#include <EEPROM.h>
#include <phi_interfaces.h>
#include <phi_prompt.h>
#include <phi_big_font.h>
#include <DS1307_1.h> 
#include <alarm_clock.h>
#include <Centipede.h>
#include <Arduino.h>
#include <Wire.h> 

/*
  Here is where you set up which "style" of outputs you want.
  As I have included an MCP IC on my build, the outputs are
  specific to me.
  People who don't have this chip need to change the pins.
  To make it easier, they are DEFINED below.
*/

// This is used to set if the blanket is also turned off when an alarm goes off.
//  If 0 nothing happens.
//  Set to 1 and when an alarm goes off, the blanket will be turned off also.
#define ABO 0


#define turn_light_on() CS.digitalWrite(1,HIGH)
#define turn_light_off() CS.digitalWrite(1,LOW)
//  Alternatively:
//  #define turn_light_on() digitalWrite(16,HIGH)
//  #define turn_light_off() digitalWrite(16,Low)

#define turn_blanket_on() CS.digitalWrite(0,HIGH)
#define turn_blanket_off() CS.digitalWrite(0,LOW)
//  Alternativley:
//  #define turn_blanket_on() digitalWrite(17,HIGH)
//  #define turn_blanket_off() digitalWrite(17,Low)





void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

But I get the error shown in the previous post.

Which to me means the libraries are causing the problems.

And I should (probably) get rid of those alternatively lines.
They aren't being used so are wasting space on the disc. :wink:

(Sorry, I'm probably ranting on)

What is also throwing me sideways is when I first installed the Arduino IDE:
It was on a RasPi, and it was all where I put it. Libraries, sketches. The whole enchilada

I moved (upgraded) to a NUC (Ubuntu) and it was kind of the same, but then SNAP decided to put things elsewhere. I then got lost.

Libraries are in some weird path that has the IDE version in it, and I don't get what happens when I go to a newer IDE version.

So before all that happened I have my local library directory where I was putting my libraries as I got them.

(I'll stop here. I don't think there is much more on THIS specifically I can say anyway.)

Are you referring to V13b.ino or some other sketch ?

(whimper)

Something else that is kind of confusing for me is in the sketch when I am writing it and #include libraries.

Pictures say 1000 words.

Screenshot from 2023-08-30 19-14-30

(Yeah, I'll delete the second Wire...)

Why different colours?
Red, Orange and Black.

The NEW sketch is V100.

There are/is no real code.

That is the whole new rebuild and what I am now using.

I'll cut/copy/paste from V13b to save only typing what can be copied.

Because the IDE colour coding is inadequate

2 Likes

What do they mean? (Or supposed to mean?)

It seems to be begging to be asked at this point for me.

Oh, just to declare it:

In/on the arduino IDE screen. Top middle.

1.8.19

So I guess that is an OLD version.
Can/should I risk getting the newer IDE or will/could that only further confuse/complicate things for me at this point in time?

Sorry, we may have lost meanings just now.

I posted the entire sketch I am now building from the ground up.
(version 100)
(Post 21)

It won't compile and throws up the error.

I dug down and found the line you mentioned back in reply 15.

Exert from the file:

  static phi_button_groups* my_btns= new phi_button_groups(mapping, pins, 6);    
  static multiple_button_input * keypads[]={my_btns, 0};
  //static LCD * lcd= new LiquidCrystal(8,9,7,6,2,3);

  const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
  LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

So I commented out the old line and put in the new line.

But that caused a/the new/next problem.

the file this is from is: phi_prompt.cpp

I just realised that and based on your next error my previous advice might have been wrong. That file has a dependency on LCD.h . Can you figure out which LCD library you have and where it came from?

I just tried to compile one of the example codes that came with the phi_prompt library but it complains about a missing LCD.h. I did install one that is part of GitHub - jenschr/Arduino-libraries: Various libraries that I either have updated or created myself (might be the wrong one) but that gave errors regarding the Wire library :frown:

@liuzengqiang is to my knowledge the author of the original phi libraries. He might have ideas.

(No problems)

The LCD.h I downloaded just now/today.

Well, it is dated today at 17:57 and it is now 20:13.

So I think I just searched for arduino LCD.h and downloaded it.

There isn't much in the way of version numbers I can find in the file.

But looking at my history today I went to this one:

LCD.h file

I had a quick look at your link.
I am using a 20x4 LCD. I only see reference to a 16x2.

I don't want to take this off on a tangent, but I just noticed this:

(WRT #include Arduino.h appearing many times in my old code, and not in the MAIN part)

#if ARDUINO < 100
#include <WProgram.h>
#else
#include <Arduino.h>
#endif

#include <LCD.h>
#include <LiquidCrystal.h>
#include <LiquidCrystal_I2C.h>
#include <avr/pgmspace.h>
#include <phi_interfaces.h>
#include <phi_prompt.h>

So why is it done here?

It contains the same library :wink: The error that I get is

c:\Users\Wim\Documents\Arduino\libraries\LiquidCrystal\I2CIO.cpp:35:10: fatal error: ../Wire/Wire.h: No such file or directory
 #include <../Wire/Wire.h>
          ^~~~~~~~~~~~~~~~

I fixed that by changing it to #include <Wire.h>.

Next I took the phi_prompt_example_string example and compiled it. I had to change a couple of lines; see below (marked with sterretje).

// Enter a string with phi_prompt for Arduino Phi-2 shield:
/*
     _______.___________..______       __  .__   __.   _______ 
    /       |           ||   _  \     |  | |  \ |  |  /  _____|
   |   (----`---|  |----`|  |_)  |    |  | |   \|  | |  |  __  
    \   \       |  |     |      /     |  | |  . `  | |  | |_ | 
.----)   |      |  |     |  |\  \----.|  | |  |\   | |  |__| | 
|_______/       |__|     | _| `._____||__| |__| \__|  \______| 

http://liudr.wordpress.com
*/

#define lcd_rows 2
#define lcd_columns 16

//The following button pins apply to phi-1 and phi-2 shields. Please make appropriate modification for your own setup.
// For phi-1 shield btn_r is 3. For phi-2 shield btn_r is 4
// sterretje, changed to uppercase last character
#define btn_U 5
#define btn_D 10
#define btn_L 11
#define btn_R 4
#define btn_B 14
#define btn_A 15
#define total_buttons 6

// LCD pin setting
// For phi-1 shield LCD_D7 is 4. For phi-2 shield LCD_D7 is 3
#define LCD_RS 8
#define LCD_EN 9
#define LCD_D4 7
#define LCD_D5 6
#define LCD_D6 2
#define LCD_D7 3

#include <LiquidCrystal.h>
#include <phi_interfaces.h>
#include <phi_prompt.h>

LiquidCrystal lcd(LCD_RS, LCD_EN, LCD_D4, LCD_D5, LCD_D6, LCD_D7);  // Create the lcd object

char mapping[] = {1, 2, 3, 4, 5, 6};                       // This is a list of names for each button.
// sterretje, changed to uppercase last character
byte pins[] = {btn_U, btn_D, btn_L, btn_R, btn_D, btn_A};  // The digital pins connected to the 6 buttons.
phi_button_groups my_btns(mapping, pins, total_buttons);
phi_serial_keypads debug_keypad(&Serial, 9600);
multiple_button_input* keypads[] = {&my_btns, &debug_keypad, 0};
char up_keys[] = {1, 0};                                                                       ///< All keys that act as the up key are listed here.
char down_keys[] = {2, 0};                                                                     ///< All keys that act as the down key are listed here.
char left_keys[] = {3, 0};                                                                     ///< All keys that act as the left key are listed here.
char right_keys[] = {4, 0};                                                                    ///< All keys that act as the right key are listed here.
char enter_keys[] = {5, 0};                                                                    ///< All keys that act as the enter key are listed here.
char escape_keys[] = {6, 0};                                                                   ///< All keys that act as the escape key are listed here.
char* function_keys[] = {up_keys, down_keys, left_keys, right_keys, enter_keys, escape_keys};  ///< All function key names are gathered here fhr phi_prompt.

void setup()
{
  Serial.begin(9600);
  lcd.begin(lcd_columns, lcd_rows);
  init_phi_prompt(&lcd, keypads, function_keys, lcd_columns, lcd_rows, '~');  // Supply the liquid crystal object, input keypads, and function key names. Also supply the column and row of the lcd, and indicator as '>'. You can also use '\x7e', which is a right arrow.
}

void loop()
{
  int result;
  phi_prompt_struct myTextInput;  // This is the structure you will use to invoke library function input_panel.

  char file_name[] = "AAAAAAAA.TXT";  // This is the buffer that will store the content of the text panel.
  myTextInput.ptr.msg = file_name;    // Assign the text buffer address
  myTextInput.low.c = 'A';            // Text panel valid input starts with character 'A'.
  myTextInput.high.c = 'Z';           // Text panel valid input ends with character 'Z'.
  myTextInput.width = 12;             // Length of the input panel is 12 characters.
  myTextInput.col = 2;                // Display input panel at column 2
  myTextInput.row = 1;                // Display input panel at row 1
  myTextInput.option = 1;             // Option 1 incluess 0-9 as valid characters. Option 0, default, option 1 include 0-9 as valid inputs.
  lcd.clear();                        // Clear the lcd
  lcd.print("File name:");            // Prompt user for input

  if (input_panel(&myTextInput) != -1)  // input_panel stores user choice in file_name.
  {
    lcd.clear();
    lcd.print("Your choice was:");  // Display the user choice one more time
    lcd.setCursor(0, 1);            // Display the list at column 2 row 1.
    lcd.print(file_name);           // Recall the text entered by the user.
  }
  else
  {
    lcd.clear();
    lcd.print("You pressed ESC");
  }
  wait_on_escape(4000);
}

This compiles (with a whole stack of warnings).

I'm not sure about the 20x4; I think it should work but I don't have a display like that.

Ok, but mine has that anyway.

So, sorry. That can't be it.

#define version_ "100"

#define phi_2_shield
#include <LiquidCrystal.h>
#include <Wire.h>
#include <stdio.h>
#include <avr/pgmspace.h>
#include <EEPROM.h>
#include <phi_interfaces.h>
#include <phi_prompt.h>
#include <phi_big_font.h>
#include <DS1307_1.h> 
#include <alarm_clock.h>
#include <Centipede.h>
#include <Arduino.h>

Arduino.h defines a number of things that are needed in the file that is compiled. If you omit it, you will probably get a number of errors from the compiler that it does not understand certain things.

The IDE basically does two things

  1. Combines all ino files into one big ino file and add Arduino.h to that big ino file. That file is one compilation unit.
  2. Compile the files based on the includes that are used. Those are different compilation units and don't know about the others so you need to include Arduino.h

You need to change code in the library.

You need to go to line 35 of I2CIO.cpp, and change it there.

My head is spinning.

I am still not up to speed with the structure of how things work.

There is the code before anything like setup{} and loop{}
These are seen by everything.
Then when you write routines their inclusions are only visible in them.
As I thought were libraries.
If they include something that is only seen within their scope.
So if the bigger part of the code needs Arduino.h, having a library include it wouldn't help that problem.
But I'm stupid.
Anyway. For now I'll put that behind me. Thanks for the answer, but I still seem to be missing something.

I don't have that path. (putting side the windows part of it.)
In my libraries I don't have a LiquidCrystal/I2CIO.cpp file

the closest thing I have to that is LiquidCrystal_I2C directory.

Also - for me - a bit of a (red) flag is the IO at the end of the filename.

I have libraries/LiquidCrystal_I2C/LiquidCrystal_I2C.cpp

(here's a cropped screen shot)


But nothing like what you mentioned.

This is the error I am seeing when I compile:

/home/me/Arduino/libraries/phi_prompt/phi_prompt.cpp: In function 'LCD* simple_setup_phi_2(byte, byte)':
/home/me/Arduino/libraries/phi_prompt/phi_prompt.cpp:1513:6: error: base operand of '->' has non-pointer type 'LiquidCrystal'
   lcd->begin(columns,rows);
      ^~
/home/me/Arduino/libraries/phi_prompt/phi_prompt.cpp:1514:60: error: cannot convert 'LiquidCrystal' to 'LCD*' for argument '1' to 'void init_phi_prompt(LCD*, multiple_button_input**, char**, int, int, char)'
   init_phi_prompt(lcd, keypads, fn_keys, columns, rows, '~');
                                                            ^

In the IDE, open file → preferences. Look for the sketchbook location; the libraries should be a subdirectory in there.

The one that I installed (your link) looks like this (windows system)

The best way to install that library is to

  1. extract the downloaded file
  2. copy the liquidcrystal directory that is in there to the libraries directory to the libraries directory in the sketchbook location.

I don't have only a LiquidCrystal directory in my libraries.

The only file I got from the LCD link is the LCD.h file.

Could you confirm which link it is?
Sorry... We may as well address this now and resolve it.

This is my entire library folder.

(pictures say 1000 words)
Sorry, but sometimes it really makes a difference.