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 3423800
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:23:53+00:00 2026-05-18T06:23:53+00:00

I have a problem, normally I would understand why this is happening, I didnt

  • 0

I have a problem, normally I would understand why this is happening, I didnt declare the function in the main method. But the class itself includes the .h file, which has the prototype for this method, so I am a bit lost on why it is not in the scope of the main function.

  using namespace std;
  #include "Solar.h"


int main(){
  initializeGL();
  Stars *Alpha = new Stars(5.0);
  Planets *Awe = new Planets(.6,2,30,"Awe",0.0,0.0,0.0);
  paintGL();
  return 0;
}

void Solar::initializeGL(){

  glShadeModel(GL_SMOOTH);

  glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
  glClearDepth(1.0f);

  glEnable(GL_DEPTH_TEST);
  glDepthFunc(GL_LEQUAL);

  glHint(GL_PERSPECTIV
  ....
 }

There is also a function paintGL() later on, and here is the header file

 class Solar {
 public:
  void initializeGL();
  void resizeGL(int width, int height);
  void paintGL();
  .....
private:
  .....
};

I am not the best with c++, so anyhelp will be appreciated.

ANd here is the error

Solar.cpp:4: error: declaration of âvoid Solar::initializeGL()â outside of class is not definition
Solar.cpp:5: error: declaration of âvoid Solar::paintGL()â outside of class is not definition
Solar.cpp: In function âint main()â:
Solar.cpp:8: error: âinitializeGLâ was not declared in this scope
Solar.cpp:11: error: âpaintGLâ was not declared in this scope
  • 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-18T06:23:54+00:00Added an answer on May 18, 2026 at 6:23 am

    Solar is a class, and initializeGL and paintGL are member functions. If you wanted to use them, you would have to create an instance of Solar.

    Solar solar;
    solar.initializeGL();
    // ...more
    solar.paintGL();
    

    Read up on member functions: http://msdn.microsoft.com/en-us/library/fk812w4w.aspx

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

Sidebar

Related Questions

I have a class that would normally just generate factory objects, however this class
I have a ridiculous question due to a ridiculous problem. Normally if I want
I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE
I have problem with fancybox. I want to write a function that will run
I have edited and simplified this question a lot. If I have this method
I have some data in a dataset and I would normally select a record
While I have the problem itself seemingly resolved, I'm hoping someone can shed some
This is probably an easy question but I can't find the answer... I have
I understand that this is a very broad question, but I was very curious
I have a class which looks approximately like this: class MeshClass { public: Anchor

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.