[英]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". 编译器告诉我“名称空间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? 到目前为止,我有做错什么吗?
您需要添加以下内容:
#include <string>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.