Skip to main content
gamedev.net
🔒 Locked

Namespace problem

Started by Horn 1 reply 250+ views
Original Post
Horn
Horn
I''m trying to convert a class to a namespace (no need to have it as a class) and I''ve ran into a wall. I''m attempting to stick with the normal definitions in the header and the actual function code in the source file. I split it up as I though was right, but it complains about the symbols being already defined in the other objects. in header file:
  
#ifndef WINDOWMANAGER
#define WINDOWMANAGER
namespace WindowManager
{
   bool fullscreen;
   void dosomething();
}
#endif
  
in the source file:
  
#include "WindowManager.h"
namespace WindowManager
{
   void dosomething()
   {
      fullscreen = false;
   }
}
  
What am I doing wrong?
Null and Void
Null and Void
Use ''extern'' in the header (in front of the variable and function).

Horn
Horn
doh! I should''ve known that. Thanks

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.