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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T15:34:06+00:00 2026-06-07T15:34:06+00:00

Possible Duplicate: Avoiding Circular Dependencies of header files Task.h: #ifndef Tasks_h #define Tasks_h #include

  • 0

Possible Duplicate:
Avoiding Circular Dependencies of header files

Task.h:

#ifndef Tasks_h
#define Tasks_h

#include "Executors.h"

class Task
{
    Executor *current_executor;
};

#endif Tasks_h

Executor.h:

#ifndef Executors_h
#define Executors_h

#include "Tasks.h"

class Executor
{
    Task *current_task;
};

#endif Executors_h

main.cpp:

#include <conio.h>
#include <stdio.h>
#include "Tasks.h"
#include "Executors.h"

int main()
{
    Executor ex;

    return 0;
}

Compilation errors:

Error   1   error C2146: syntax error : missing ';' before identifier 'current_task'    c:\users\rain\documents\visual studio 2010\projects\text\text\executors.h   8
Error   2   error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   c:\users\rain\documents\visual studio 2010\projects\text\text\executors.h   8
Error   3   error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   c:\users\rain\documents\visual studio 2010\projects\text\text\executors.h   8

Again… in C# i never can meet such problems, but i do my best to support C++ and use it.
Don’t want to code all classes in one header file

  • 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-06-07T15:34:07+00:00Added an answer on June 7, 2026 at 3:34 pm

    this is just an example. there maybe be pointers instead

    If you can switch to using pointers, you could replace header inclusions with forward declarations:

    #ifndef Executors_h
    #define Executors_h
    
    class Task;
    
    class Executor
    {
        Task *current_task_ptr;
    };
    
    #endif Executors_h
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Avoiding repeated constants in CSS I want to include a class within
Possible Duplicate: What are the best practices for avoiding xss attacks in a PHP
Possible Duplicate: Difference of create Index by using include column or not using Edit:
Possible Duplicate: Avoiding repeated constants in CSS I have a javascript file that I
Possible Duplicate: Avoiding repeated constants in CSS We have some theme colors that are
Possible Duplicates: Gracefully avoiding NullPointerException in Java Multilingual fields in DB tables Exact duplicate
Possible Duplicate: How do I use define_method to create class methods? I am trying
Possible Duplicate: How do I make a request using HTTP basic authentication with PHP
Possible Duplicate: && operator in Javascript In the sample code of the ExtJS web
Possible Duplicate: How can I convert a list<> to a multi-dimensional array? I want

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.