title: C++ "using" declaration in Visual Studio 2008
body: <p>I am trying to use google protobuf and they have the following example:</p>
  
  <pre><code>using google::protobuf;
  
  protobuf::RpcChannel* channel;
  protobuf::RpcController* controller;
  SearchService* service;
  SearchRequest request;
  SearchResponse response;
  
  void DoSearch() {
    // You provide classes MyRpcChannel and MyRpcController, which implement
    // the abstract interfaces protobuf::RpcChannel and protobuf::RpcController.
    channel = new MyRpcChannel("somehost.example.com:1234");
    controller = new MyRpcController;
  
    // The protocol compiler generates the SearchService class based on the
    // definition given above.
    service = new SearchService::Stub(channel);
  
    // Set up the request.
    request.set_query("protocol buffers");
  
    // Execute the RPC.
    service-&gt;Search(controller, request, response, protobuf::NewCallback(&amp;Done));
  }
  
  void Done() {
    delete service;
    delete channel;
    delete controller;
  }
  </code></pre>
  
  <p>The error I am getting when I try to implement this code in Visual Studio Express 2008 is:  </p>
  
  <blockquote>
    <p>error C2873: 'google::protobuf' :
    symbol cannot be used in a
    using-declaration</p>
  </blockquote>
  
  <p>Edit: When I do "using namespace google::protobuf;" inside of a function it no longer gives me the error. What I'm confused about is that it doesn't work the way that Google's example (and Stroustrup's in "The C++ Programming Language") seem to indicate.</p>