Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++: std does not have member "string"

I have coded the following:

STDMETHODIMP CWrapper::openPort(LONG* m_OpenPortResult)
{
    std::string str;
    //const char * c = str.c_str();
    // Open("test".c_str())

    return S_OK;
}

The compiler tells me "There is no such member "string" in the namespace std".

My includes look like this:

#include "stdafx.h"
#include "Wrapper.h"
#include <string.h>
using namespace std;

Did I do anything wrong so far?

like image 845
tmighty Avatar asked Feb 13 '14 22:02

tmighty


1 Answers

You need to add the following:

#include <string>
like image 159
Peter R Avatar answered Sep 28 '22 06:09

Peter R