奇怪的error C2143错误
#include <map>
#include <string>
#include <algorithm>
#include <stdlib.h>
#include "icp.h "
//---------------------------------------------
enum DeviceType{ thermometer, thermostat };
struct DeviceState{ //State for a device
DeviceType type;
const char * model;
std::string location;
short nominal_temp; //For thermostats only
};
typedef map <unsigned long, DeviceState> StateMap;
。。。
static StateMap dstate;
编译信息:
C:\test\IDL_TEST\icp.cpp(18) : error C2143: syntax error : missing '; ' before ' < '
C:\test\IDL_TEST\icp.cpp(18) : error C2143: syntax error : missing '; ' before ' < '
C:\test\IDL_TEST\icp.cpp(27) : error C2146: syntax error : missing '; ' before identifier 'dstate '
C:\test\IDL_TEST\icp.cpp(27) : fatal error C1004: unexpected end of file found
请高手帮忙解答一下
[解决办法]
似乎是map没有用std
这样可以编译过去
#include <string>
#include <map>
using namespace std;
enum DeviceType{ thermometer, thermostat };
struct DeviceState{ //State for a device
DeviceType type;
const char * model;
std::string location;
short nominal_temp; //For thermostats only
};
typedef std::map <unsigned long, DeviceState> StateMap;
static StateMap dstate;
int main()
{
}