问题
我想开个专栏叫蛋疼的错误集锦
。今日分错误:
wrong number of template arguments (1, should be at least 2)
我定义了一个结构体,然后建了个map。编译过程中报了以上错误。我的代码如下
#include <map>
#include "curl/curl.h"
using namespace std;
//相机参数结构体
typedef struct _CameraCon
{
int iLastHeartBeat; // 最后一次心跳
std::string strIP; // 设备IP
std::string strUserName; // 设备用户名
std::string strPassWord; // 设备密码
std::string strConTime; // 最后一次心跳时间
CURL* conn; // 连接句柄
}CameraCon;
typedef std::map<std::string strName, CameraCon> CameraInofMap;
大家看出问题在哪里吗。揭晓答案:typedef std::map<std::string strName, CameraCon>
我在定义map的时候给string赋值了!-》std::string strName
。。。。。。大无语,说实话这个问题我还查了好久你能信。
解决方法
typedef std::map<std::string, CameraCon> CameraInofMap;