Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. namespace does not exist

namespace does not exist

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorial
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    doneirik
    wrote on last edited by
    #1

    Hello, Could anyone tell me how to cope with this error message. the start of my code goes like #pragma once using namespace std; ... I get the errormessage that the namespace does not exist, and msdn provide little information about this error message. error C2871: ´std´:a namespace with this name does not exist Sorry if I provide to little code or further descriptions... But maybe somebody has a tips best regards doneirik

    M T C 3 Replies Last reply
    0
    • D doneirik

      Hello, Could anyone tell me how to cope with this error message. the start of my code goes like #pragma once using namespace std; ... I get the errormessage that the namespace does not exist, and msdn provide little information about this error message. error C2871: ´std´:a namespace with this name does not exist Sorry if I provide to little code or further descriptions... But maybe somebody has a tips best regards doneirik

      M Offline
      M Offline
      Martijn van Kleef
      wrote on last edited by
      #2

      That should compile OK on any machine. Exactly on what line did you get the error message? Maybe where the error is generated your code is at a different scope not within that of your "using" declaration? Maybe where the error is generated the header file with your "using" declaration is not included?

      1 Reply Last reply
      0
      • D doneirik

        Hello, Could anyone tell me how to cope with this error message. the start of my code goes like #pragma once using namespace std; ... I get the errormessage that the namespace does not exist, and msdn provide little information about this error message. error C2871: ´std´:a namespace with this name does not exist Sorry if I provide to little code or further descriptions... But maybe somebody has a tips best regards doneirik

        T Offline
        T Offline
        toxcct
        wrote on last edited by
        #3

        this can come from the files you really include. for example : #include <string.h> this will include all the C standard function to manipulate C-string (strcat(), strlen(), etc...) in the global namespace : ::strcat(), ::strlen(),... #include <CSTRING> this will put the functions in the std namespace : std::strcat(), std::strlen(), ...


        TOXCCT >>> GEII power
        [toxcct][VisualCalc]

        1 Reply Last reply
        0
        • D doneirik

          Hello, Could anyone tell me how to cope with this error message. the start of my code goes like #pragma once using namespace std; ... I get the errormessage that the namespace does not exist, and msdn provide little information about this error message. error C2871: ´std´:a namespace with this name does not exist Sorry if I provide to little code or further descriptions... But maybe somebody has a tips best regards doneirik

          C Offline
          C Offline
          CP Visitor
          wrote on last edited by
          #4

          doneirik wrote: Could anyone tell me how to cope with this error message. the start of my code goes like #pragma once using namespace std; ... I get the errormessage that the namespace does not exist, and msdn provide little information about this error message. error C2871: ´std´:a namespace with this name does not exist You probably should include a file with code in namespace std before 'using' namespace std, e.g.

          #include <vector>
          using namespace std;

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups