Passing a string as a function parameter

I am trying to pass a string, ( the file path and name) to a function. I am getting the error.

variable or field 'onSignalSound' declared void

Here is the method.

void onSignalSound(Adafruit_VS1053_FilePlayer mp, String fileName) {
	
/*
	* if(irSensor == true){
	* //play the file
	* }
	*/

	// Play one file, don't return until complete
	Serial.println(F("Playing sound file - "));
	Serial.println(fileName);

	mp.playFullFile(fileName);
}

That error is from the Arduino IDE.

If I'm in Visual Studio using the VM extension I get this error with the same code.

no suitable conversion function from String to const char*

I am trying to pass a string,

No, you are trying to pass a String.

Don't do that, just use a stringvoid onSignalSound(Adafruit_VS1053_FilePlayer mp, const char* fileName) {

so in C++, const char* parametername

is the functional equivalent of string fileName in c#?

No idea - I know virtually zero C#, but I doubt they're equivalent.

C++ has a class called String (note the capital 'S') while C prefers to use a char array for strings (lowercase 's'). They are defined as:

String myName;
char yourName[15];

As you might guess, Strings come with a lot of methods just like C# (e.g., Substring, IndexOf, etc.) that are easy to use, but horribly wasteful of memory. Also, their dynamic nature often can lead to memory fragmentation. Because of this, most Arduino programmers prefer to use C strings built from char arrays. There is a complete complement of supporting str*() and mem*() functions for string processing that will almost always save you memory over the String alternative. You can see some of the family of string functions at:

while C prefers to use a char array for strings (lowercase 's').

C "prefers" char arrays because that is the ONLY thing it can use.