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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:17:24+00:00 2026-05-23T13:17:24+00:00

So I have a class included in another class that keeps throwing a compile

  • 0

So I have a class included in another class that keeps throwing a compile error of the form “error: ‘ProblemClass’ has not been declared. The files are set up thusly:

#ifndef PROBLEMCLASS_H
#define PROBLEMCLASS_H

#include <iostream>
#include <cmath>

class ProblemClass
{
  public:

    virtual void Init() = 0;
};

#endif

and the class where the error occurs looks like this:

#ifndef ACLASS_H
#define ACLASS_H

#include "problemclass.h"

class AClass : public Base
{
  public:

    void DoSomething(ProblemClass* problem);

};

#endif

The compile error occurs at void Dosomething();

I’m aware the code here isn’t enough to solve the problem. I’ve been unable to create a minimal example that can reproduce it. So my question is much more general; what sort of things might cause this? Is there anything in particular I should look for, or some line of enquiry I should be following to track it down?

This code compiles fine in an almost identical version of the project.

Help of any sort would be greatly appreciated, no matter how vague. I’m using codeblocks 10.05 with mingw4.4.1 in win 7 64 bit.

  • 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-23T13:17:24+00:00Added an answer on May 23, 2026 at 1:17 pm

    You seem to be saying that the code you are showing doesn’t actually produce the compiler error that you are having a problem with. So we can only guess. Here are some possibilities:

    • You could have forgot to include problemclass.h from the file where you are using ProblemClass.
    • You could have misspelled the name of ProblemClass either in its own header file or in the place where you are using it. This can be hard to spot if it is a capitalization error such as writing Problemclass or problemClass instead of ProblemClass.
    • You could have copy-pasted your inclusion guard #defines from one header file to another and then forgot to change the defined names. Then only the first of those two included header files would take effect.
    • You could have placed ProblemClass in a namespace A, in which case you must refer to ProblemClass as A::ProblemClass if you are referring to it from outside the namespace A.
    • You may be using templates and not expecting two-phase lookup to work the way it does.
    • You could have misspelled the file name in your include. The compiler would not report an error on that if you also have an old version of that file under the misspelled name.
    • You could have made ProblemClass a macro that only gets defined after you include problemclass.h, in which case what you see as ProblemClass gets replaced by something else by the macro preprocessor.
    • You could have defined ProblemClass in a header file other than problemclass.h and then problemclass.h actually defines something else.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a DAL class library that is included in my program as a
I have some code that has a dynamic-class system in C++ that has a
Let's say you have a class library project that has any number of supplemental
I have been working on a project that has common bits of functionality, specifically
I have an XML document that has HTML tags included: <chapter> <h1>title of content</h1>
I am using C#. I have created a class which can be included in
I have a class includes.vb that holds some variables (sharing them with other pages)
I have a class that includes a std::list and wish to provide public begin()
I have a class that I want to include in a GWT module. Unfortunately,
Lets say I have the following DataMapper resources: class Post include DataMapper::Resource has n,

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.