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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:06:07+00:00 2026-06-01T21:06:07+00:00

I am trying to figure out what this compile error means, and I hope

  • 0

I am trying to figure out what this compile error means, and I hope I explain this well.

In file included from sys/charon.cpp:4:0:

Following this takes me to that ^ file above, and underlines in yellow this:

#include "../headers/charon.h"

As well the type identifier "charon_", which is a class defined within the header file charon.h, is also underlined in yellow possibly a different error.

sys/../headers/charon.h:17:9: error: redefinition of ‘class charon::charon_’
sys/../headers/chio.h:86:9: error: previous definition of ‘class charon::charon_’
sys/charon.cpp:12:20: error: definition of implicitly-declared ‘charon::charon_::charon_()’

However I hope they are all related to the first error, I think it is related to something I am trying to do.

//File 1.h
/**********/
class I
{
private:
B* my_private_b;

public:
I(B& handle);
}

Unfortunately I need ‘B’ declared before ‘file 1’ begins defining ‘I’.. yet at the same time, I need I to be defined for B. So I don’t know how to define both before the other.. I am guessing I need a more advanced solution but I don’t know.

//File 2.h
/***********/
class B
{
private:
I i;
O o;

public:
B();
}

So if I can find an answer to that, then maybe I could just check this next part for myself. If you think it would be good to check to see if I am going in the right direction I will paste all the code in question below.

.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.

Not Long Enough, Didn’t Read?
Well here are all the lines, except for the comments, of code from all four files. In order of perceived importance.

//////////////////////////////////////
/////
/////////////
/////
/////
/////
//File: chio.h

#ifndef CHIO_H
#define CHIO_H
#include <deque>
#include <queue>
#include <iostream>

using namespace std;

namespace charon
{
  class charon_
  {
    
  };
}
namespace chio
{ 
  class chout_
  {
  private:
    
  public:
    chout_();
    ~chout_();
  };
  
  class chin_
  {
  private:
    charon::charon_* engine;

  public:
    chin_(charon::charon_& handle);
    chin_();
    ~chin_();
  };
}

#endif  /* CHIO_H */

//////////////////////////////////////
/////
/////////////
/////
/////
/////
//File: charon.h/* 
//
 * File:   charon.h
 * Author: josh
 *
 * Created on 11 April 2012, 22:26
 */

#ifndef CHARON_H
#define CHARON_H
//#include "boost/thread.hpp"
#include "chio.h"

using namespace std;
using namespace chio;
namespace charon
{
  class charon_ {
  private:
    chout_ engine_output;
    chin_ engine_input;
    //boost::thread input_thread;
    //boost::thread output_thread;
    void start_threads();
    void stop_threads();

  public:
    charon_();
    charon_(charon_ &orig);
    ~charon_();
    void run();
  };
}


#endif  /* CHARON_H */

These are the constructors / cpp files.

charon.cpp
#include <iostream>
//#include <boost/thread.hpp>
//#include <boost/date_time.hpp>
#include "../headers/charon.h"

using namespace std;
using namespace charon;
using namespace chio;

namespace charon
{
  charon_::charon_(){
    engine_input = chio::chin_((charon_*)this);
  }
};

//^^charon.cpp^^
---------
//chin.cpp

#include <iostream>
#include <borland/conio.h>
#include <ncurses.h>
#include <deque>
#include "../headers/charon.h"

using namespace std;
using namespace charon;
using namespace chio;
namespace chio
{
  chin_::chin_(charon::charon_& handle) {
    engine = handle;
  }
  chin_::~chin_() {
  }
}

And for the finale, I personally hate reading so I’ve been putting off just asking all this of anybody. So if you have come this far you probably want this too.

"/usr/bin/gmake" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
gmake[1]: Entering directory `/home/josh/Projects/Maze/Charon'
"/usr/bin/gmake"  -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/charon
gmake[2]: Entering directory `/home/josh/Projects/Maze/Charon'
mkdir -p build/Debug/GNU-Linux-x86/sys
rm -f build/Debug/GNU-Linux-x86/sys/charon.o.d
g++    -c -g -MMD -MP -MF build/Debug/GNU-Linux-x86/sys/charon.o.d -o build/Debug/GNU-Linux-x86/sys/charon.o sys/charon.cpp
In file included from sys/charon.cpp:4:0:
sys/../headers/charon.h:17:9: error: redefinition of ‘class charon::charon_’
sys/../headers/chio.h:86:9: error: previous definition of ‘class charon::charon_’
sys/charon.cpp:12:20: error: definition of implicitly-declared ‘charon::charon_::charon_()’
gmake[2]: *** [build/Debug/GNU-Linux-x86/sys/charon.o] Error 1
gmake[2]: Leaving directory `/home/josh/Projects/Maze/Charon'
gmake[1]: *** [.build-conf] Error 2
gmake[1]: Leaving directory `/home/josh/Projects/Maze/Charon'
gmake: *** [.build-impl] Error 2

I would be simply glad to have an answer to my simpler version. I have run out of ideas to fix the compile errors and I have flipped through my huge C++ reference verifying everything I can think of. All the syntax looks to be correct, I think it is just that I have yet to specifically learn how to manipulate the compiler to do things like this.

I don’t know, I am probably just rambling now. This has been frustrating me for the last 3 days at least.

  • 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-01T21:06:09+00:00Added an answer on June 1, 2026 at 9:06 pm

    It seems like in File1.h a forward declaration of B would suffice instead of including it since you’re only using references and pointers to B. Add:

    class B; // << Forward declaration of B
    
    class I
    {
    private:
    B* my_private_b;
    
    public:
    I(B& handle);
    }
    

    at the beginning of File1.h

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

Sidebar

Related Questions

I am trying to figure out this error from previous 3 hours. By searching,
I'm trying to figure out why this code won't compile. I have interface A
Well I'm trying to figure out inheritance in c++, and I'm getting a compile
Trying to figure out this pseudo code. The following is assumed.... I can only
I'm trying to figure out this weird issue I've been having, and the root
So I've been toiling over this app trying to figure out this strange behaviour
I'm a newbie with jQuery and I'm trying to figure out this slideToggle function.
trying to figure out why this is happening - I have an input text
I'm trying to figure out if this is possible. I have a class, BaseGameEntity,
I'm trying to figure out how this would be done in practice, so as

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.