Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6469567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:00:28+00:00 2026-05-25T06:00:28+00:00

I am trying to write a kernel in c++ and I am a beginner

  • 0

I am trying to write a kernel in c++ and I am a beginner in OS development. Now I am implementing cout to display on a monitor, but I am facing some problems. I know the question I am asking is foolish, but I am a newbie in c++ as well.

I have written an OStream class which calls the system function write to display on the screen. Its base class is my Video class. This class is included into namespace std. So the main problem is that when I create a object of OStream, it is not calling it’s constructor and hence not calling the constructor of its base class, so that videomemory is not initialising and therefore nothing will be displayed on screen.

Here is my code:

/*OStream.h*/
namespace std{
class OStream:public Video{
    public:
    OStream();
    OStream& operator<<(int);
    OStream& operator<<(String);
    OStream& operator<<(char *cp);
    OStream& operator<<(char c);
    OStream& operator<<(unsigned char *cq);
    OStream& operator<<(unsigned char c1);
};
extern OStream cout;
}

/*OStream.cpp*/
namespace std{
    OStream cout;
    OStream::OStream(){}
    OStream& OStream::operator<<(char *cp){
        write(cp);
    }
    .
    . 
    .
    .
}

In the above code I am creating an object of OStream class in the OStream.cpp file itself.
But if I create an object in my main module then it calls its constructor successfully, but then cout is not working.

That means if I create an object explicitly it works perfectly, but how can I create an object implicitly.

And same thing is happening with my Interrupt.cpp module.

So please help me to solve this type of problem.
Please help me.
Any help will be appreciated.
Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:00:29+00:00Added an answer on May 25, 2026 at 6:00 am

    First, your implementation of cout is non-conforming. If you’re going to be writing a C++ standard library, you must write it to be conforming to said standard (not to what you think the standard is).

    Second, you need to implement static constructor support. You haven’t specified your compiler, so all I can say is figure out where your compiler puts its static constructor initialization code, and make sure to invoke it on program startup.

    You may have more luck adapting existing C++ libraries (GCC’s libstdc++ or clang’s libc++) to your new OS than writing one from scratch. Writing a C++ stdlib is NOT something for a beginner; you’ll be neck-deep in template metaprogramming in no time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a kernel module, which prints some information about the objects
I need to write some kernel module for my university classes and now I'm
im trying to write an app that will display a list off lines from
I'm trying to write a Python script to test the output of some various
I am trying to write a module with some c and some python parts.
So, im trying to write some code that utilizes Nvidia's CUDA architecture. I noticed
Hey, I'm trying to write a kernel to essentially do the following in C
Hello I'm trying to write a CUDA kernel to perform the following piece of
I'm trying to write a histogram kernel in OpenCL to compute 256 bin R,
So I'm trying to write a kernel module that uses the linux/timer.h file. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.