title: "x is not a class or namespace name" when trying to use functions between namespaces
body: <p>I am new to C++ and am currently trying to implement namespaces.</p>
  <p>Here, you can see, I have a namespace, <code>GameEngine_CORE</code>, where all the behind-the-scenes work is done. I have the namespace <code>SandBox</code>, which is where the user actually would write their game.</p>
  <p>I need <code>SandBox</code> to be able to access some of the variables in <code>GameEngine_CORE</code>, which seems to work fine (I have put a list of <code>using GameEngine_CORE::...</code> to save the user's time).</p>
  <p>However, I also need <code>GameEngine_CORE</code> to be able to call the <code>start()</code> and <code>update()</code> function in <code>SandBox</code>, but upon compilation I get an error every time I try and call something from <code>SandBox</code>, eg: <code>SandBox::start();</code></p>
  <blockquote>
  <p>'SandBox' is not a class or namespace name</p>
  </blockquote>
  <p>I am coding in Visual Studio, and compiling in Debug mode for Windows x64.</p>
  <pre class="lang-cpp prettyprint-override"><code>#pragma once
  #include &quot;SDL.h&quot;
  #undef main
  #include &lt;iostream&gt;
  #include &lt;math.h&gt;
  #include &lt;vector&gt;
  #include &lt;stdio.h&gt; // Temp
  
  #include &quot;Vec2.h&quot;
  #include &quot;Log.h&quot;
  #include &quot;Time.h&quot;
  #include &quot;Boundary.h&quot;
  #include &quot;Ray.h&quot;
  #include &quot;Particle.h&quot;
  #include &quot;Polygon.h&quot;
  #include &quot;Path.h&quot;
  #include &quot;Circle.h&quot;
  
  namespace GameEngine_CORE {
      // Renderer
      SDL_Renderer* renderer;
      SDL_Window* window;
      bool isRunning;
      bool fullscreen;
      // Mouse
      int mouseX;
      int mouseY;
      Uint32 mouse;
      // Keyboard
      Vec2 arrowInp;
      // Collision Stack
      std::vector&lt;Boundary&gt; collisionStack;
      // Log
      Log logger;
      // Physics
      Time timer;
      Time clockTime;
      float deltaTime;
      Vec2 gravity = Vec2(0, -9.8f);
  
      void handleEvents();
      void render();
      void createWindow();
      void destroyWindow();
  
      // For the SandBox Program
      void SandBox::start();
      void SandBox::update();
  
      int main() { // Entry Point
          double m_LastClock = 0.0;
          clockTime.StartTimer(); // Start Counter
  
          SandBox::start(); // For user
          while (isRunning) {
              double m_CurrentClock;
              m_CurrentClock = clockTime.GetTimer(); // Get Counter
              deltaTime = (float)(m_CurrentClock - m_LastClock);
              if (deltaTime &gt; 0.15f) {
                  deltaTime = 0.15f;
              }
              handleEvents();
              render();
  
              m_LastClock = m_CurrentClock;
          }
  
          destroyWindow();
  
          return 0;
      }
  
      // Initialise the window to draw to
      void createWindow() {
          // Set window size and type
          fullscreen = true;
          Uint32 flags = 0;
          flags = SDL_WINDOW_RESIZABLE;
          if (fullscreen) {
              flags = flags | SDL_WINDOW_MAXIMIZED;
          }
          if (SDL_Init(SDL_INIT_EVERYTHING) == 0) {
              logger.Message(&quot;Subsystems Initialised&quot;);
  
              window = SDL_CreateWindow(&quot;2D Engine&quot;, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 300, 300, flags);
              if (window) {
                  logger.Message(&quot;Window Created&quot;);
                  // Minimum window size
                  SDL_SetWindowMinimumSize(window, 1000, 1000);
              }
              // Create Renderer for window
              renderer = SDL_CreateRenderer(window, -1, 0);
              if (renderer) {
                  SDL_SetRenderDrawColor(renderer, 121, 121, 121, 255);
                  logger.Message(&quot;Renderer Created&quot;);
                  // Set how to blend alphas and colours
                  SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND);
                  isRunning = true;
              }
          }
      }
  
      void destroyWindow() {
          // Frees memory associated with renderer and window
          SDL_DestroyRenderer(renderer);
          SDL_DestroyWindow(window);  //error here
          SDL_Quit();
      }
  
      // Handles SDL events
      void handleEvents() {
          // Check for quit
          SDL_Event event;
          SDL_PollEvent(&amp;event);
  
          // Check we have latest inputs
          SDL_PumpEvents();
  
          // Reset inputs
          arrowInp.x = 0; arrowInp.y = 0;
  
          // If we get quit event, stop running and free up memory
          switch (event.type) {
          case SDL_QUIT:
              isRunning = false;
              break;
          case SDL_KEYDOWN:
              switch (event.key.keysym.sym)
              {
              case SDLK_LEFT: arrowInp.x = -1; break;
              case SDLK_RIGHT: arrowInp.x = 1; break;
              }
              switch (event.key.keysym.sym)
              {
              case SDLK_UP: arrowInp.y = -1; break;
              case SDLK_DOWN: arrowInp.y = 1; break;
              }
              break;
          default:
              break;
          }
  
  
      }
  
      // Render Function
      void render() {
          // Set back ground colour and clear renderer every frame
          SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
          SDL_RenderClear(renderer);
  
          SandBox::update();
  
          SDL_RenderPresent(renderer); // Draw to the screen
      }
  }
  
  using GameEngine_CORE::createWindow;
  using GameEngine_CORE::deltaTime;
  using GameEngine_CORE::mouse;
  using GameEngine_CORE::mouseX;
  using GameEngine_CORE::mouseY;
  using GameEngine_CORE::renderer;
  using GameEngine_CORE::arrowInp;
  using GameEngine_CORE::collisionStack;
  
  namespace SandBox { // Where the user of the engine would write code
      // Drawing Vars
      Particle particle = Particle(50, 359.99f, Vec2(900, 700));
      Boundary boundaries[] = { Boundary(Vec2(800, 0), Vec2(800, 1000)), Boundary(Vec2(300, 300), Vec2(400, 700)), Boundary(Vec2(300, 700), Vec2(800, 800)) };
      GameEngine::Polygon square = GameEngine::Polygon(Vec2(800, 400), 45, Vec2(400, 200), 4);
      GameEngine::Polygon poly1 = GameEngine::Polygon(Vec2(200, 400), Vec2(200, 200), 6);
      GameEngine::Polygon ellipse = GameEngine::Polygon(Vec2(1200, 600), Vec2(200, 400), 64);
      Path path = Path(Vec2(500, 100));
      Circle circle = Circle(100, Vec2(800, 500));
  
      GameEngine::Polygon player = GameEngine::Polygon(Vec2(700, 400), 0, Vec2(60, 60), 16);
      float moveSpeed;
      Vec2 velocity;
  
      float rotator = 0;
  
      // Functions
      static void collision();
  
      static void start() {   // Called when the program starts
          createWindow();
  
          moveSpeed = 1000.0f;
  
          path.addPoints(std::vector&lt;Vec2&gt; { Vec2(200, 100), Vec2(200, 800), Vec2(350, 800), Vec2(700, 650), Vec2(400, 400), Vec2(200, 100)});
      }
  
  
      static void update() { // Repeats every frame
          printf(&quot;%f secs \n&quot;, deltaTime);
          // Get the mouse' current state
          mouse = SDL_GetMouseState(&amp;mouseX, &amp;mouseY);
          particle.setPos(Vec2((float)mouseX, (float)mouseY));
  
          SDL_SetRenderDrawColor(renderer, 255, 255, 255, SDL_ALPHA_OPAQUE);      // Draw Boundaries
  
          rotator += 0.01f;
          poly1.setRot(rotator);
  
          // Player
          player.Show(renderer);
  
          square.Show(renderer);
          poly1.Show(renderer);
          ellipse.Show(renderer);
          path.Show(renderer);
  
          collision();
      }
  
      static void collision() {
          // Clears stack
          collisionStack.clear();
  
          // Adds colliders to stack
          square.makeCollider(collisionStack);
          poly1.makeCollider(collisionStack);
          ellipse.makeCollider(collisionStack);
          path.makeCollider(collisionStack);
          player.makeCollider(collisionStack);
  
          // Draw Particles
          SDL_SetRenderDrawColor(renderer, 255, 255, 0, 100);
          particle.collide(renderer, collisionStack);
      }
  
      static void movement() {
          Vec2 velocity = arrowInp * moveSpeed;
      }
  }
  </code></pre>
  <p>I don't imagine anyone needs to see the header files, but I can provide them if requested. I also declare my <code>start()</code> and <code>update()</code> functions in <code>GameEngine_CORE</code>, which I'm not sure is correct, however I was getting complaints from Visual Studio that it could not find the function definitions otherwise.</p>