[SOLVED] "was not declared in this scope" afther linkin the .h file

Hi guys i m at the end of my sanity with this so i thought there might be someone able to help me.

This is main program made as easy as posible:

#include <LiquidCrystal.h>
#include <LiquidCrystal_I2C.h>

#include "mastermind.h"
#include "lcd_wrapper.h"

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

void loop() {
  // put your main code here, to run repeatedly:
  delay(1000);
  lcd_print_at(1,0,"pls just work");
  lcd_clear();
}

And here is the .h file that i made:

#include <Arduino.h>
#include <LiquidCrystal.h>
#include <LiquidCrystal_I2C.h>

#include "lcd_wrapper.h"


void lcd_init(){
  lcd.init();   // initialize the lcd 
  lcd.init();
  // Print a message to the LCD.
  lcd.backlight();
}

void lcd_clear(){
  lcd.clear();
}


void lcd_set_cursor(int y, int x){
  lcd.setCursor(x,y);
}


void lcd_print(char* text){
    Serial.println(text);
}


void lcd_print_at(int y, int x, char* text){
    lcd_set_cursor(y, x);
    lcd_print(text);
}

but i must be doing somerhing wrong bcs it is posting this error:

sketch\lcd_wrapper.cpp: In function 'void lcd_init()':

lcd_wrapper.cpp:9:3: error: 'lcd' was not declared in this scope

   lcd.init();   // initialize the lcd

   ^~~

sketch\lcd_wrapper.cpp: In function 'void lcd_clear()':

lcd_wrapper.cpp:16:3: error: 'lcd' was not declared in this scope

   lcd.clear();

   ^~~

sketch\lcd_wrapper.cpp: In function 'void lcd_set_cursor(int, int)':

lcd_wrapper.cpp:21:3: error: 'lcd' was not declared in this scope

   lcd.setCursor(x,y);

   ^~~

exit status 1
'lcd' was not declared in this scope

Ty for your help.

So where is "lcd" declared?

DO NOT put executable code (or variable definitions) in .h files (except for class function definitions and templates). Doing so will cause linker errors when the .h file is #included in multiple source files.

For proper use of .h, .cpp files, see: Reply #3 Here.

Yea u right i was declaring display in the ps6 and it didnt worked so i've deleted it but i have not realized that error was pointing me to lcd_wrapper.h. Ty for help it might seem trivial but i spent few hours with this so ty knownASWOL.

And gfvalvo i know but i must do it this way bcs this is the assignment and it is very specific.

ren741:
And gfvalvo i know but i must do it this way bcs this is the assignment and it is very specific.

If you post the exact wording of the assignment, maybe we can advise