My own library

I would like to create my own library. Since I have used java programming so far, I do not know exactly how the header in C++ works. I tried to google it but it's a big topic.
Can someone advise me why I have a bug "error: expected unqualified-id before 'int'" in the LcdMenu.h???
And what's the problem with the String declaration???

I created it according to this example (https://www.arduino.cc/en/Hacking/LibraryTutorial)

If anyone knew about a tutorial that would be about creating a library, but without wide C++ knowledge
feel free to throw him into the comment.

My heder file

#ifndef LcdMenu
#define LcdMenu

#include <Arduino.h>

class LcdMenu
{
	public:
		LcdMenu(int _scrNr);
		void addTextLine1(int _scrNr, String _line);
		void addTextLine2(int _scrNr, String _line);
		void addTextLine3(int _scrNr, String _line);
		void addTextLine4(int _scrNr, String _line);
		void setOnOff(int _scrNr, bool _onOff, String _ifTrue, String _ifFalse);
		void setOnOff(int _scrNr, bool _onOff);
		void setValue(int _scrNr, String _text, int _hodnotaI);
		void setValue(int _scrNr, String _text, float _hodnotaF);
		String getLine1(int _scrNr);
		String getLine2(int _scrNr);
		String getLine3(int _scrNr);
		String getLine4(int _scrNr);
		float getValue(int _scrNr);
		float getLastValue(int _scrNr);
	private:
		int scrNr, arrayLenght;
		float value, lastValue;
		bool onOff;
		String line1, line2, line3, line4, ifTrue, ifFalse;
};

#endif

My cpp file

#include "LcdMenu.h" //include deklaraciu tejto triedy

int scrNr, arrayLenght; 
float value, lastValue;
bool onOff;
String line1, line2, line3, line4, ifTrue, ifFalse;
String myMenu[][];

//constructor
LcdMenu::LcdMenu(int _scrNr){
	arrayLenght = _scrNr;
	myMenu = new myMenu[arrayLenght][9]; //screen count // 9 = values
	/*
	* 0 - onOff
	* 1 - line1
	* 2 - line2
	* 3 - line3
	* 4 - line4
	* 5 - ifTrue
	* 6 - ifFalse
	* 7 - value
	* 8 - lastValue
	*/
}

//destructor
LcdMenu::LcdMenu(int _scrNr){}

void LcdMenu::addTextLine1(int _scrNr, String _line){
	myMenu[scrNr][1] = _line.substring(0,19);
}

void LcdMenu::addTextLine2(int _scrNr, String _line){
	myMenu[scrNr][2] = _line.substring(0,19);
}

void LcdMenu::addTextLine3(int _scrNr, String _line){
	myMenu[scrNr][3] = _line.substring(0,19);
}

void LcdMenu::addTextLine4(int _scrNr, String _line){
	myMenu[scrNr][4] = _line.substring(0,19);
}

void LcdMenu::setOnOff(int _scrNr, bool _onOff, String _ifTrue, String _ifFalse){
	myMenu[scrNr][0] = _onOff;
	myMenu[scrNr][5] = _ifTrue;
	myMenu[scrNr][6] = _ifFalse;
}

void LcdMenu::setOnOff(int _scrNr, bool _onOff){
	myMenu[scrNr][0] = _onOff;
}

void LcdMenu::setValue(int _scrNr, String _line, int _valueI){
	myMenu[scrNr][3] = _line; 
	myMenu[scrNr][8] = myMenu[scrNr][7];
	myMenu[scrNr][7] = _valueI;
}

void LcdMenu::setValue(int _scrNr, String _line, float _valueF){
	myMenu[scrNr][3] = _line; 
	myMenu[scrNr][8] = myMenu[scrNr][7];
	myMenu[scrNr][7] = _valueF;
}

String LcdMenu::getLine1(int _scrNr){
	return myMenu[scrNr][1];
}

String LcdMenu::getLine2(int _scrNr){
	return myMenu[scrNr][2];
}

String LcdMenu::getLine3(int _scrNr){
	return myMenu[scrNr][3];
}

String LcdMenu::getLine4(int _scrNr){
	return myMenu[scrNr][4];
}

float LcdMenu::getValue(_scrNr){
	return myMenu[scrNr][7].toFloat();
}

float LcdMenu::getLasValue(_scrNr){
	return myMenu[scrNr][8].toFloat();
}

Thank you for your time and help...

#ifndef LcdMenu
#define LcdMenu

Include guards do NOT #define a name that is the same as the class name.

Can someone advise me why I have a bug "error: expected unqualified-id before 'int'" in the LcdMenu.h???

Without knowing which line caused the error? No me. I'm too lazy to recreate the error message you should have posted EXACTLY as the compiler spit it out.

And what's the problem with the String declaration???

Which one? And why so f**king many question marks. The proper number is ONE!

You should NOT be using Strings AT ALL.

#define LcdMenu

preprocessor sees this and says, ok replace every "LcdMenu" with an empty string.

SO this:

class LcdMenu
{
	public:
		LcdMenu(int _scrNr);
		void addTextLine1(int _scrNr, String _line);

becomes:

class
{
	public:
		(int _scrNr);
		void addTextLine1(int _scrNr, String _line);

See the problem now?

BTW: You have a bigger bug waiting for you. In your .cpp the very first thing you do is shadow all your member variables. Don't do that. Just use the member variables. Or if you don't want to use them then dont' make it a class.

These:

int scrNr, arrayLenght; 
float value, lastValue;
bool onOff;
String line1, line2, line3, line4, ifTrue, ifFalse;
String myMenu[][];

Shadow all of these:

private:
		int scrNr, arrayLenght;
		float value, lastValue;
		bool onOff;
		String line1, line2, line3, line4, ifTrue, ifFalse;

The ones in the .cpp should probably be removed.

void LcdMenu::addTextLine1(int _scrNr, String _line){
	myMenu[scrNr][1] = _line.substring(0,19);
}

Why do you need so many of these functions? When you catch yourself putting numbers on variable names or function names then you want an array.

void LcdMenu::addTextLine(int _row, int _scrNr, String _line){
	myMenu[scrNr][_row] = _line.substring(0,19);
}

Also:

String LcdMenu::getLine1(int _scrNr){
	return myMenu[scrNr][1];
}

All those could just be one function:

String LcdMenu::getLine1(int _row, int _scrNr){
	return myMenu[scrNr][_row];
}
String myMenu[][];

A two dimensional array with zero elements in each dimension ?

Ralph Bacon's library tutorial.

Ok, so I made changes to your suggestions.

PaulS

Include guards do NOT #define a name that is the same as the class name.

and Delta_G

preprocessor sees this and says, ok replace every "LcdMenu" with an empty string.

I did not realize it. Thanks

Delta_G i deleted the .cpp declarations and reduced my functions (Good idea with the functions i did not think)

UKHeliBob

A two dimensional array with zero elements in each dimension ?

I tried to declare the String in a different way because I was getting error with String declaration. It was foolish.

.cpp after change:

#include "LcdMenu.h" //include deklaraciu tejto triedy

//constructor
LcdMenu::LcdMenu(int _scrNr){
 arrayLenght = _scrNr;
 String myMenu[arrayLenght][9]; //screen count // 9 = values
 /*
 * 0 - onOff
 * 1 - line1
 * 2 - line2
 * 3 - line3
 * 4 - line4
 * 5 - ifTrue
 * 6 - ifFalse
 * 7 - value
 * 8 - lastValue
 */
}

void LcdMenu::addTextLine(int _scrNr, int lineNr, String _line){
 myMenu[scrNr][lineNr] = _line.substring(0,19);
}


void LcdMenu::setOnOff(int _scrNr, bool _onOff, String _ifTrue, String _ifFalse){
 myMenu[scrNr][0] = _onOff;
 myMenu[scrNr][5] = _ifTrue;
 myMenu[scrNr][6] = _ifFalse;
}

void LcdMenu::setOnOff(int _scrNr, bool _onOff){
 myMenu[scrNr][0] = _onOff;
}

void LcdMenu::setValue(int _scrNr, String _line, int _valueI){
 myMenu[scrNr][3] = _line; 
 myMenu[scrNr][8] = myMenu[scrNr][7];
 myMenu[scrNr][7] = _valueI;
}

void LcdMenu::setValue(int _scrNr, String _line, float _valueF){
 myMenu[scrNr][3] = _line; 
 myMenu[scrNr][8] = myMenu[scrNr][7];
 myMenu[scrNr][7] = _valueF;
}

String LcdMenu::getLine(int _scrNr, int lineNr){
 return myMenu[scrNr][lineNr];
}

float LcdMenu::getValue(int _scrNr)
{
	return myMenu[_scrNr][7].toFloat();
}

float LcdMenu::getLastValue(int _scrNr)
{
	return myMenu[_scrNr][8].toFloat();
}

.h after change:

#ifndef Lcd_MenuLib
#define Lcd_MenuLib

#if (ARDUINO >=100)
 #include "Arduino.h"
#else
 #include "WProgram.h"
#endif

class LcdMenu
{
 public:
 LcdMenu(int _scrNr);
 void addTextLine(int _scrNr, int lineNr, String _line);
 void setOnOff(int _scrNr, bool _onOff, String _ifTrue, String _ifFalse);
 void setOnOff(int _scrNr, bool _onOff);
 void setValue(int _scrNr, String _text, int _hodnotaI);
 void setValue(int _scrNr, String _text, float _hodnotaF);
 String getLine(int _scrNr, int lineNr);
 float getValue(int _scrNr);
 float getLastValue(int _scrNr);
 private:
 int scrNr, arrayLenght;
 float value, lastValue;
 bool onOff;
 String line1, line2, line3, line4, ifTrue, ifFalse;
};

#endif

New error msg:

Arduino: 1.8.4 (Windows 7), Vývojová doska:"Arduino Nano, ATmega328P"

Voľby pre zostavenie sa zmenili, zostavujem všetko znova 
C:\Users\SKHC2629\Documents\Arduino\libraries\LcdMenu\LcdMenu.cpp: In member function 'void LcdMenu::addTextLine(int, int, String)':

C:\Users\SKHC2629\Documents\Arduino\libraries\LcdMenu\LcdMenu.cpp:22:2: error: 'myMenu' was not declared in this scope

  myMenu[scrNr][lineNr] = _line.substring(0,19);

  ^

C:\Users\SKHC2629\Documents\Arduino\libraries\LcdMenu\LcdMenu.cpp: In member function 'void LcdMenu::setOnOff(int, bool, String, String)':

C:\Users\SKHC2629\Documents\Arduino\libraries\LcdMenu\LcdMenu.cpp:27:2: error: 'myMenu' was not declared in this scope

  myMenu[scrNr][0] = _onOff;

  ^

C:\Users\SKHC2629\Documents\Arduino\libraries\LcdMenu\LcdMenu.cpp: In member function 'void LcdMenu::setOnOff(int, bool)':

C:\Users\SKHC2629\Documents\Arduino\libraries\LcdMenu\LcdMenu.cpp:33:2: error: 'myMenu' was not declared in this scope

  myMenu[scrNr][0] = _onOff;

  ^

C:\Users\SKHC2629\Documents\Arduino\libraries\LcdMenu\LcdMenu.cpp: In member function 'void LcdMenu::setValue(int, String, int)':

C:\Users\SKHC2629\Documents\Arduino\libraries\LcdMenu\LcdMenu.cpp:37:2: error: 'myMenu' was not declared in this scope

  myMenu[scrNr][3] = _line; 

  ^

C:\Users\SKHC2629\Documents\Arduino\libraries\LcdMenu\LcdMenu.cpp: In member function 'void LcdMenu::setValue(int, String, float)':

C:\Users\SKHC2629\Documents\Arduino\libraries\LcdMenu\LcdMenu.cpp:43:2: error: 'myMenu' was not declared in this scope

  myMenu[scrNr][3] = _line; 

  ^

C:\Users\SKHC2629\Documents\Arduino\libraries\LcdMenu\LcdMenu.cpp: In member function 'String LcdMenu::getLine(int, int)':

C:\Users\SKHC2629\Documents\Arduino\libraries\LcdMenu\LcdMenu.cpp:49:9: error: 'myMenu' was not declared in this scope

  return myMenu[scrNr][lineNr];

         ^

C:\Users\SKHC2629\Documents\Arduino\libraries\LcdMenu\LcdMenu.cpp: At global scope:

C:\Users\SKHC2629\Documents\Arduino\libraries\LcdMenu\LcdMenu.cpp:52:31: error: 'float LcdMenu::getValue' is not a static member of 'class LcdMenu'

 float LcdMenu::getValue(_scrNr){

                               ^

C:\Users\SKHC2629\Documents\Arduino\libraries\LcdMenu\LcdMenu.cpp:52:25: error: '_scrNr' was not declared in this scope

 float LcdMenu::getValue(_scrNr){

                         ^

C:\Users\SKHC2629\Documents\Arduino\libraries\LcdMenu\LcdMenu.cpp:52:32: error: expected ',' or ';' before '{' token

 float LcdMenu::getValue(_scrNr){

                                ^

C:\Users\SKHC2629\Documents\Arduino\libraries\LcdMenu\LcdMenu.cpp:56:34: error: 'float LcdMenu::getLasValue' is not a static member of 'class LcdMenu'

 float LcdMenu::getLasValue(_scrNr){

                                  ^

C:\Users\SKHC2629\Documents\Arduino\libraries\LcdMenu\LcdMenu.cpp:56:28: error: '_scrNr' was not declared in this scope

 float LcdMenu::getLasValue(_scrNr){

                            ^

C:\Users\SKHC2629\Documents\Arduino\libraries\LcdMenu\LcdMenu.cpp:56:35: error: expected ',' or ';' before '{' token

 float LcdMenu::getLasValue(_scrNr){

                                   ^

exit status 1
Nastala chyba pri kompilácii pre dosku Arduino Nano.

Táto správa by mala mať viac informácií v
"Zobrazenie podrobného výstupu pri kompilácii"
podľa zapnutá voľba v Súbor -> Nastavenia.

.
.
.
PaulS why?

You should NOT be using Strings AT ALL.

Could you guys even once to look at the current problem please?
Why he does not recognize myMenu?

Thank you so mutch

Tomas309:
PaulS why? Could you guys even once to look at the current problem please?

The problems with the String function are well documented in this forum. Do a little searching

Why he does not recognize myMenu?

I imagine because you declare / define it as a local variable within the constructor rather than a class member variable.

LcdMenu::LcdMenu(int _scrNr){
	arrayLenght = _scrNr;
	String myMenu[arrayLenght][9]; //screen count // 9 = values

It is unlikely that the array myMenu should be local to the constructor.

#ifndef Lcd_MenuLib
#define Lcd_MenuLib

The usual convention is className_H.

Why he does not recognize myMenu?

The addTextLine() method does not recognize myMenu because it is local the constructor. It no longer exists when addTextLine() is called.

PaulS:
And why so f**king many question marks. The proper number is ONE!

0 != 1

But how do I declare myMenu outside of the constructor? When I do not know the arrayLenght until i want to create the class?

I found this example on StackExchange but is it the way to go?

// Declaration
int* myArray = 0;
int myArraySize = 0;

// Allocation (let's suppose size contains some value discovered at runtime,
// e.g. obtained from some external source or through other program logic)
if (myArray != 0) {
    delete [] myArray;
}
myArray = new int [size];

Thank you

I kind of like dynamic allocation, if used carefully. Others will (properly) warn you about the limited memory available on the basic AVR Arduino boards and the danger of memory fragmentation with repeated new(ing) and delet(ing) -- or malloc(ing) and free(ing).

With the various 32-bit processors in the Arduino ecosystem you have more than 10x the RAM of an UNO, so it’s not quite as bad. But, I’d still avoid excessive allocating and de-allocating.

Caveat: the above is simply my opinion and personal preference. You could also just assign the size statically based on the largest array you think you're going to need.

Since you are on a microcontroller you make the array the biggest you will ever need or allow it to get. Then you keep track of how many elements you actually use with a variable. I know you think that wastes memory, but what else would you use that memory for if your program might need it later for a larger array?

Why does your LcdMenu constructor take an argument that it doesn't use?

Array indices start at 0, not 1. You are writing outside the bounds of your array. Epic FAIL!

You are STILL using Strings. Epic FAIL!

PaulS:
Why does your LcdMenu constructor take an argument that it doesn't use?

Array indices start at 0, not 1. You are writing outside the bounds of your array. Epic FAIL!

You are STILL using Strings. Epic FAIL!

When I have a constructor without an argument, the compiler throws a error.
I want to write only to array 1-4 if you mean "i" in for loop.
I start to read about the Strings.

I deleted my previous post because I found a mistake in my code... I'll get back to it soon.

Hello again, :slight_smile:

it's done, I used a char[] instead of String with a fixed size of the array(30). But it still does not work for me.
The actual program looks like this:
LcdMenu.cpp

#include "LcdMenu.h" //include deklaraciu tejto triedy

//constructor
LcdMenu::LcdMenu(bool Nothing){
	//arrayLenght = _scrNr;
	
}

void LcdMenu::addTextLine(int _scrNr, int _lineNr, char _line[]){
	myMenu[_lineNr][scrNr] = _line;
}


void LcdMenu::setOnOff(int _scrNr, bool _onOff, char _ifTrue[], char _ifFalse[]){
	myMenu[0][scrNr] = _onOff;
	myMenu[5][scrNr] = _ifTrue;
	myMenu[6][scrNr] = _ifFalse;
}

void LcdMenu::setOnOff(int _scrNr, bool _onOff){
	myMenu[0][scrNr] = _onOff;
}

void LcdMenu::setValue(int _scrNr, char _line[], int _valueI){
	myMenu[3][scrNr] = _line; 
	myMenu[8][scrNr] = myMenu[scrNr][7];
	myMenu[7][scrNr] = _valueI;
}

void LcdMenu::setValue(int _scrNr, char _line[], float _valueF){
	myMenu[3][scrNr] = _line; 
	myMenu[8][scrNr] = myMenu[scrNr][7];
	myMenu[7][scrNr] = _valueF;
}

char LcdMenu::getLine(int _scrNr, int _lineNr){
	return myMenu[_lineNr][_scrNr];
}

float LcdMenu::getValue(int _scrNr){
	return atof(myMenu[7][_scrNr]);
}

float LcdMenu::getLastValue(int _scrNr){
	return atof(myMenu[8][_scrNr]);
}

LcdMenu.h

#ifndef Lcd_MenuLib
#define Lcd_MenuLib

#if (ARDUINO >=100)
	#include "Arduino.h"
#else
	#include "WProgram.h"
#endif

#define maxMenuCount 30

class LcdMenu
{
	public:
		//LcdMenu(int _scrNr = 18);
		LcdMenu(bool Nothing=false);
		void addTextLine(int _scrNr, int _lineNr, char _line[]);
		void setOnOff(int _scrNr, bool _onOff, char _ifTrue[], char _ifFalse[]);
		void setOnOff(int _scrNr, bool _onOff);
		void setValue(int _scrNr, char _text[], int _hodnotaI);
		void setValue(int _scrNr, char _text[], float _hodnotaF);
		char getLine(int _scrNr, int _lineNr);
		float getValue(int _scrNr);
		float getLastValue(int _scrNr);
	private:
		int scrNr, arrayLenght;
		float value, lastValue;
		bool onOff;
		char line1[20], line2[20], line3[20], line4[20], ifTrue[20], ifFalse[20];
		char myMenu[9][maxMenuCount]; // 9 = values  //screen count
		/*
		* 0 - onOff
		* 1 - line1
		* 2 - line2
		* 3 - line3
		* 4 - line4
		* 5 - ifTrue
		* 6 - ifFalse
		* 7 - value
		* 8 - lastValue
		*/
};

#endif

Testcode

#include <LcdMenu.h>

LcdMenu menu(false);

void setup() {
  Serial.begin(9600);
}

void loop()
{
  delay(200);
  Serial.println("***");
  menu.addTextLine(1,1, "test");
  Serial.println(menu.getLine(1,1));
  delay(5000);
}

Why the menu.getLine(1,1); does not print something??

void LcdMenu::addTextLine(int _scrNr, int _lineNr, char _line[]){
	myMenu[_lineNr][scrNr] = _line;
}

That is NOT how to copy data from one array to another. myMenu[_lineNr][scrNr] is a char.

_line[] is an array. You can NOT store an array of chars in a char variable.

OP - For info on manipulating c-strings, take a look at:
http://www.cplusplus.com/reference/cstring/

Ok guys,

Now the code looks like this:

the cpp file

#include "LcdMenu.h" //include deklaraciu tejto triedy

//constructor
LcdMenu::LcdMenu(){
 
}

void LcdMenu::addTextLine(int _lineNr, char _line[]){
 //strcpy(myMenu[_lineNr], _line);
 memcpy(myMenu[_lineNr], &_line[0], 19);
}


void LcdMenu::setOnOff(bool _onOff, char _ifTrue[], char _ifFalse[]){
 onOff = _onOff;
 strcpy(myMenu[5], _ifTrue);
 strcpy(myMenu[6], _ifFalse);
}

void LcdMenu::setOnOff(bool _onOff){
 onOff = _onOff;
}

void LcdMenu::setValue(char _line3[], int _valueI){
 strcpy(myMenu[3], _line3); 
 lastValueI = valueI;
 valueI = _valueI;
 valueIset = true;
 valueFset = false;
}

void LcdMenu::setValue(char _line3[], float _valueF){
 strcpy(myMenu[3], _line3); 
 lastValueF = valueF;
 valueF = _valueF;
 valueFset = true;
 valueIset = false;
}

const char* LcdMenu::getLine(int _lineNr){
 if (_lineNr == 4)
 {
 if(strlen(myMenu[5]) > 0 && strlen(myMenu[6]) > 0)
 {
 if(onOff)
 { strcpy(myMenu[4], myMenu[5]); }
 else
 { strcpy(myMenu[4], myMenu[6]); }
 }
 else if(strlen(myMenu[4]) <= 0)
 { //4=min width, 3= precision
 if (valueFset){return dtostrf(valueF,4,2, myMenu[0]);}
 if (valueIset){return dtostrf(valueI,4,0, myMenu[0]);} 
 }
 return myMenu[_lineNr];
 }
 else
 return myMenu[_lineNr];
}

float LcdMenu::getValueF(){ return valueF;}

float LcdMenu::getLastValueF(){ return valueF;}

int LcdMenu::getValueI(){ return valueI;}

int LcdMenu::getLastValueI(){ return valueI;}

In .h file "define maxMenuCount 21" should I also consider a place for a null character? Or I only have to enter 20
the .h file

#ifndef Lcd_MenuLib
#define Lcd_MenuLib

#if (ARDUINO >=100)
 #include "Arduino.h"
#else
 #include "WProgram.h"
#endif

#define maxMenuCount 21 //+nulcharakter?

class LcdMenu
{
 public:
 LcdMenu();
 void addTextLine(int _lineNr, char _line[]);
 void setOnOff(bool _onOff, char _ifTrue[], char _ifFalse[]);
 void setOnOff(bool _onOff);
 void setValue(char _line3[], int _hodnotaI);
 void setValue(char _line3[], float _hodnotaF);
 const char* getLine(int _lineNr);
 float getValueF();
 int getValueI();
 float getLastValueF();
 int getLastValueI();
 private:
 int scrNr, arrayLenght;
 float valueI, valueF, lastValueI, lastValueF;
 bool onOff, valueFset, valueIset;
 char line1[20], line2[20], line3[20], line4[20], ifTrue[20], ifFalse[20];
 char myMenu[9][maxMenuCount]; // 9 = values  //screen count
 /*
 * 0 - temp
 * 1 - line1
 * 2 - line2
 * 3 - line3
 * 4 - line4
 * 5 - ifTrue
 * 6 - ifFalse
 * 7 - 
 * 8 - 
 */
};

#endif

the test sketch

#include <LcdMenu.h>

LcdMenu menu();

void setup() {
  Serial.begin(9600);
}

void loop()
{
  delay(200);
  Serial.println("***");
  
  menu.addTextLine(1, "test1 too large text line");
  menu.addTextLine(2, "test2");
  menu.addTextLine(3, "test3");
  //menu.addTextLine(4, "test4");
  //menu.setOnOff(false, "It is true", "It is false");
  menu.setValue("Value :", 10.5f);
  
  for(int i=1; i<=4;i++)
  {
    Serial.print(i);
    Serial.print(": ");
    Serial.println(menu.getLine(i));
  }
  
  delay(5000);
}

See if you can find any improvements. I have only one problem now.
I removed the argument from the constructor of LcdMenu(), the compiler throws out an error:

Arduino: 1.8.4 (Windows 7), Vývojová doska:"Arduino/Genuino Uno"

C:\Users\SKHC2629\Documents\Arduino\HomeAutomationTest\HomeAutomationTest.ino: In function 'void loop()':

HomeAutomationTest:14: error: request for member 'addTextLine' in 'menu', which is of non-class type 'LcdMenu()'

   menu.addTextLine(1, "test1 too large text line");

        ^

HomeAutomationTest:15: error: request for member 'addTextLine' in 'menu', which is of non-class type 'LcdMenu()'

   menu.addTextLine(2, "test2");

        ^

HomeAutomationTest:16: error: request for member 'addTextLine' in 'menu', which is of non-class type 'LcdMenu()'

   menu.addTextLine(3, "test3");

        ^

HomeAutomationTest:19: error: request for member 'setValue' in 'menu', which is of non-class type 'LcdMenu()'

   menu.setValue("Value :", 10.5f);

        ^

HomeAutomationTest:25: error: request for member 'getLine' in 'menu', which is of non-class type 'LcdMenu()'

     Serial.println(menu.getLine(i));

                         ^

exit status 1
request for member 'addTextLine' in 'menu', which is of non-class type 'LcdMenu()'

Táto správa by mala mať viac informácií v
"Zobrazenie podrobného výstupu pri kompilácii"
podľa zapnutá voľba v Súbor -> Nastavenia.

Why? And thanks to all of you for your help...

When I remove the argument from the constructor of LcdMenu(), the compiler throws out an error:

You need to show us THAT code, NOT just try (poorly) to explain what you did.