Thread: extern namespace?

  1. #1
    Making mistakes
    Join Date
    Dec 2008
    Posts
    476

    Post extern namespace?

    Hi, I'm doing a small project and I want to define all my prototypes in one header, because they are dependent on each other. But now I'm using namespaces, and I cant do it anymore:

    Code:
    ...
    void Namespace::Function(void)
    ...
    namespace Namespace {
        ...
        void Function() {
            return;
        }
    }
    It gives an error. Why can't I do:

    Code:
    extern namespace Namespace;
    ...
    
    OR
    
    namespace Namespace;
    ...

  2. #2
    The larch
    Join Date
    May 2006
    Posts
    3,573
    I think it is:

    Code:
    //header
    namespace my_namespace
    {
    void prototype();
    }
    
    
    //implementation
    namespace my_namespace
    {
    void prototype()
    {
        //... implementation ...
    }
    }
    That is, you can open up the namespace (and even put more things in it) anywhere.
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  3. #3
    Making mistakes
    Join Date
    Dec 2008
    Posts
    476
    Thx, it worked!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. extern classes
    By Swordsman in forum C++ Programming
    Replies: 1
    Last Post: 05-07-2008, 02:07 AM
  2. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  3. Replies: 16
    Last Post: 10-29-2006, 05:04 AM
  4. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  5. Headers that use each other
    By nickname_changed in forum C++ Programming
    Replies: 7
    Last Post: 10-03-2003, 04:25 AM