Page 1 of 1
Error expected ‘;’ before while error
Posted: Fri Apr 08, 2022 2:17 pm
by Mehmetdev1
Hello, Error expected ‘;’ before while error How can I fix the problems and I will share the screen of the error.
Code: Select all
void printf(char* str)
{
unsigned short* VideoMemory = (unsigned short*)0xb8000;
for(int i = 0; str[i] != '\0'; ++i)
VideoMemory[i] = (VideoMemory[i] & 0xFF00) | str[i];
}
void kernelMain(void* multiboot_structure, unsigned int magicnumber)
{
printf("Kapiler İsletim Sistemi")
while(1);
}
Re: Error expected ‘;’ before while error
Posted: Fri Apr 08, 2022 2:31 pm
by Octocontrabass
You forgot a ";" on a different line.
Re: Error expected ‘;’ before while error
Posted: Fri Apr 08, 2022 2:40 pm
by Mehmetdev1
Octocontrabass wrote:You forgot a ";" on a different line.
No, The error is not that, I tried it myself.
Re: Error expected ‘;’ before while error
Posted: Fri Apr 08, 2022 2:55 pm
by Octocontrabass
Yes it is. You forgot the ";" on the previous line.
Re: Error expected ‘;’ before while error
Posted: Fri Apr 08, 2022 3:25 pm
by Mehmetdev1
When I put a semicolon in the previous line, it gives an error as follows. I will send the screenshot and code to the message.
Code: Select all
void printf(char* str)
{
unsigned short* VideoMemory = (unsigned short*)0xb8000;
for(int i = 0; str[i] != '\0'; ++i)
VideoMemory[i] = (VideoMemory[i] & 0xFF00) | str[i];
}
void kernelMain(void* multiboot_structure, unsigned int magicnumber)
{
printf("Kapiler İsletim Sistemi");
while(1);
}
Re: Error expected ‘;’ before while error
Posted: Fri Apr 08, 2022 3:27 pm
by klange
Mehmetdev1 wrote:When I put a semicolon in the previous line, it gives an error as follows. I will send the screenshot and code to the message.
There is no error in your screenshot. You are getting a
warning because string constants are
const char* and you are passing one to a function that just takes
char * which C++ does not like.