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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:54:37+00:00 2026-06-05T12:54:37+00:00

I just can’t win with headers it seems. I have a class Log of

  • 0

I just can’t win with headers it seems.

I have a class Log of which has a header Log.h that defines the class Log, and then the Log.cpp implements the methods of Log. I need it available in Main.cpp, so I include Log.h into Main.cpp and I receive the notorious “already defined” errors.

If I take out the header from Main.cpp, I can’t use the class.
If I take out the header from Log.cpp, then Log is (obviously) not defined.

I can’t win here! What do I do?

EDIT YES, of course I have include guards.

#ifndef LOG_H_
#define LOG_H_

namespace vexal {

#define CCOL_RESET  "^[[0m"
#define CCOL_RED    "^[[31m"

class Log {
public:
    Log();
    virtual ~Log();
    static void genInstance();
private:
    static Log* _inst;
};

}

#endif /* LOG_H_ */

Then the includes are merely #include "Log.h" in both Log.cpp and Main.cpp.

  • 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-05T12:54:39+00:00Added an answer on June 5, 2026 at 12:54 pm

    The issue ended up being the order of which the includes were included. Some includes have to be included before others to avoid redefinition issues.

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

Sidebar

Related Questions

I just can't seem to get localization to work. I have a class library.
I just can't figure this out. I have a script that gets data from
I just can't get the ajax service to work. A simple class to $.get(http://google.com)
I just can't see what's wrong with this code.. it seems to be the
I just can't find a simple answer to this simple question I have from
I just can't display the button at the bottom of the screen. I have
I just can't work this one out. I have a table with a column
i have this simple code i just can't get it working. <html> <head> <script
I just can't figure out why i get the error message, I have tried
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

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.