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

  • Home
  • SEARCH
  • 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 7799621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:22:15+00:00 2026-06-02T00:22:15+00:00

I have several files, listed just below, wherein I define some namespaces and classes.

  • 0

I have several files, listed just below, wherein I define some namespaces and classes. Then in one of the files I am trying to incorporate the classes from the others. The issue is that the compiler seems to not be able to find my namespaces.

charon.cpp

chin.cpp

chout.cpp

main.cpp

My namespaces are charon, charon_in, and charon_out. The main problems come up on a particular file, charon.cpp, so here is that file and chin.cpp too.

The errors:

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
sys/charon.cpp:6:17: error: ‘charon_in’ is not a namespace-name
sys/charon.cpp:6:26: error: expected namespace-name before ‘;’ token
sys/charon.cpp:7:17: error: ‘charon_out’ is not a namespace-name
sys/charon.cpp:7:27: error: expected namespace-name before ‘;’ token
sys/charon.cpp:15:5: error: ‘chout_’ does not name a type
sys/charon.cpp:16:5: error: ‘chin_’ does not name a type
sys/charon.cpp:31:39: error: ‘chin_’ has not been declared
sys/charon.cpp:31:55: error: ‘engine_input’ was not declared in this scope
sys/charon.cpp:32:40: error: ‘chout_’ has not been declared
sys/charon.cpp:32:57: error: ‘engine_output’ was not declared in this scope

charon.cpp

#include <iostream>
#include <boost/thread.hpp>
#include <boost/date_time.hpp>

using namespace std;
using namespace charon_in;
using namespace charon_out;

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:
    //Methods
};

chin.cpp

#include <iostream>
#include <borland/conio.h>
#include <ncurses.h>
#include <boost/thread.hpp>

using namespace std;
using namespace charon;
using namespace charon_out;

namespace charon_in
{
  class chin_
  {
  private:
    bool pause;
    charon_* engine;
    inline iostream grab();
  public:
    //Methods
};

I triple checked everything. So I am pretty confident the syntax is correct, but obviously I’m missing some key concept otherwise the compiler wouldn’t complain.

(I know putting classes in the cpp files isn’t a standard thing to do, but I know it is possible to do it so that’s why I chose to try.)

I can’t see what mistakes I’ve made. Any help would be appreciated.

  • 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-02T00:22:17+00:00Added an answer on June 2, 2026 at 12:22 am

    You need to include the header file that declares the namespace (or declare it again) before the using directive:

    // using namespace test;  // Error test is not known to be a namespace
    namespace test {}
    using namespace test;     // Fine -- test is known
    

    As Wayne correctly points out, you probably want to restructure your code differently, including header files that will contain the declarations and can be included in different translation units.

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

Sidebar

Related Questions

I have several CSS files listed in my base.html, and while one of them
I have several PHP files include()ing other files from several other directories. In one
I have a directory containing several files, some of which have spaces in their
I have a large projects with breakpoints in several files. Some disabled, some enabled.
I have several files I'd like to label. When I click on one I
I have several files which is causing a compile error, can the following be
I have several batch files that I call from a parent batch file. I
I have several hundred files in a non-flat directory structure. My Makefile lists each
I have several .csv files with similar filenames except a numeric month (i.e. 03_data.csv,
What is an algorithm for joining PCM files? I have several PCM files I

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.