OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 2:17 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Error expected ‘;’ before while error
PostPosted: Fri Apr 08, 2022 2:17 pm 
Offline

Joined: Fri Apr 01, 2022 10:06 am
Posts: 23
Location: Türkiye, Uşak/Merkez
Hello, Error expected ‘;’ before while error How can I fix the problems and I will share the screen of the error.

Code:
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);

}


Attachments:
Ekran görüntüsü 2022-04-08 231251.png
Ekran görüntüsü 2022-04-08 231251.png [ 11.57 KiB | Viewed 1320 times ]

_________________
M. Alp
Top
 Profile  
 
 Post subject: Re: Error expected ‘;’ before while error
PostPosted: Fri Apr 08, 2022 2:31 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
You forgot a ";" on a different line.


Top
 Profile  
 
 Post subject: Re: Error expected ‘;’ before while error
PostPosted: Fri Apr 08, 2022 2:40 pm 
Offline

Joined: Fri Apr 01, 2022 10:06 am
Posts: 23
Location: Türkiye, Uşak/Merkez
Octocontrabass wrote:
You forgot a ";" on a different line.

No, The error is not that, I tried it myself.

_________________
M. Alp


Top
 Profile  
 
 Post subject: Re: Error expected ‘;’ before while error
PostPosted: Fri Apr 08, 2022 2:55 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
Yes it is. You forgot the ";" on the previous line.


Top
 Profile  
 
 Post subject: Re: Error expected ‘;’ before while error
PostPosted: Fri Apr 08, 2022 3:25 pm 
Offline

Joined: Fri Apr 01, 2022 10:06 am
Posts: 23
Location: Türkiye, Uşak/Merkez
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:
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);

}


Attachments:
Ekran görüntüsü 2022-04-09 002445.png
Ekran görüntüsü 2022-04-09 002445.png [ 18.13 KiB | Viewed 1301 times ]

_________________
M. Alp
Top
 Profile  
 
 Post subject: Re: Error expected ‘;’ before while error
PostPosted: Fri Apr 08, 2022 3:27 pm 
Offline
Member
Member

Joined: Wed Mar 30, 2011 12:31 am
Posts: 676
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.

_________________
toaruos on github | toaruos.org | gitlab | twitter | bim - a text editor


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 24 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group