Thread: namespace tm?

  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    271

    namespace tm?

    I had this really weird problem where I had defined some classes in a custom namespace, but couldn't get it to compile because the compiler couldn't find these classes within the namespace. After fiddling with it for several hours, I thought, "hey, maybe I should try changing the name of the namespace!" And it worked.

    So now I'm wondering: why is the namespace "tm" causing problems?

    The only header files I was including were standard headers from g++ 4.2. Is there a namespace "tm" hidden somewhere in the g++ library? Or is it something to do with the c++ standard itself?

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    tm is not reserved by the standard, and I would doubt that the g++ people would use tm as a namespace name either. (And even if they did, it wouldn't matter: you can always add to a namespace at any time.) So there was something else going on.

    Edit: Or, hey, structs are namespaces too, aren't they. Never mind, then.
    Last edited by tabstop; 01-28-2009 at 03:05 PM.

  3. #3
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    I'm guessing there was some sort of namespace name issue due to "struct tm" in <time.h>.

    gg

  4. #4
    Registered User
    Join Date
    Oct 2005
    Posts
    271
    Thanks! That makes sense.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. namespace problem
    By DL1 in forum C++ Programming
    Replies: 8
    Last Post: 10-17-2008, 12:10 PM
  2. global namespace errors
    By stubaan in forum C++ Programming
    Replies: 9
    Last Post: 04-02-2008, 03:11 PM
  3. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  4. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  5. data validation & namespace
    By tiange in forum C++ Programming
    Replies: 4
    Last Post: 07-05-2005, 02:45 AM