我编写了以下代码:
STDMETHODIMP CWrapper::openPort(LONG* m_OpenPortResult)
{
std::string str;
//const char * c = str.c_str();
// Open("test".c_str())
return S_OK;
}
编译器告诉我“在命名空间 std 中没有这样的成员“string””。
我的包含看起来像这样:
#include "stdafx.h"
#include "Wrapper.h"
#include <string.h>
using namespace std;
到目前为止我做错了什么吗?
最佳答案
您需要添加以下内容:
#include <string>
关于C++: std 没有成员 "string",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21767053/