OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 4:39 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Why doesnt my print function work?
PostPosted: Thu Dec 01, 2022 6:33 pm 
Offline

Joined: Thu Dec 01, 2022 5:48 pm
Posts: 3
Location: The Milky Way Galaxy
I'm following Daedalus Community's [url="https://www.youtube.com/watch?v=EpFUzjYehxs"]Making an OS (x86)[/url] tutorial.
Ive gotten to chapter 7, where you start writing the kernel in C. I'm trying to program a print function, but it doesn't work... And the stack trace doesn't give a clue...

Theres only one error.

Code:
kernel.c:31: undefined reference to `_GLOBAL_OFFSET_TABLE_'


Here's the code:

Code:
void print(char text[]) {
   unsigned int i = 0;
   unsigned int addr = 753664; // 0xb8000 in hex
   while (text[i] != 0) {
      *(char*)addr = text[i];
      i+=1;
      addr+=2;
   }
   return;
}

extern void main() {
   print("test");
   return;
}


I'm definitely a beginner, so this may just be a stupid mistake.
Any help would be appreciated, Thanks.

_________________
Proud user of GCC.


Top
 Profile  
 
 Post subject: Re: Why doesnt my print function work?
PostPosted: Sun Dec 04, 2022 11:18 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
madpickle wrote:
I'm following Daedalus Community's Making an OS (x86) tutorial.

Be warned: most tutorials have bugs. (Since I personally can't sit through a video tutorial, I couldn't say how good or bad this one is.)

madpickle wrote:
Code:
kernel.c:31: undefined reference to `_GLOBAL_OFFSET_TABLE_'

Doesn't that tutorial say you need to use a cross-compiler? This error means you're not using a cross-compiler.


Top
 Profile  
 
 Post subject: Re: Why doesnt my print function work?
PostPosted: Mon Dec 05, 2022 11:07 am 
Offline

Joined: Thu Dec 01, 2022 5:48 pm
Posts: 3
Location: The Milky Way Galaxy
I already solved this issue, but I had no way to delete a topic while it was waiting for moderator approval...

_________________
Proud user of GCC.


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Amazonbot [bot] and 44 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