Problem with Neo-M8N gps from tinygpsplus library

esp32-gps

I just use a sample code from tinygpsplus but it seems weird? please can somebody help me with this

You are not writing valid .cpp code, you are writing in .ino style like in the Arduino IDE (or have copied an example from the Arduino IDE which was in an .ino file).

When you want to call the function displayInfo(), it must have a function declaration coming before the point of usage. See the FAQ for converting.

In your case, all you have to do is write

void displayInfo();

before the setup function on the global scope.