首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

那位帮小弟我看下这段代码出错在哪里了

2012-04-19 
那位帮我看下这段代码出错在哪里了?ini_file.hpp文件内容如下:#ifndef _INI_FILE_H_#define _INI_FILE_H_#

那位帮我看下这段代码出错在哪里了?
ini_file.hpp文件内容如下:
#ifndef _INI_FILE_H_
#define _INI_FILE_H_

#include <vector>
#include <string>


struct Entry
{
std::string name;
std::string value;
};

struct Category
{
std::string name;
std::vector<Entry> entries;
};

typedef std::vector<Category> CategoryList;
编译后出现如下错误:
1>d:\workplace\c++\imageprocess\imageprocess\ini\ini_file.hpp(9) : error C2236: unexpected 'struct' 'Entry'. Did you forget a ';'?
1>d:\workplace\c++\imageprocess\imageprocess\ini\ini_file.hpp(9) : error C2143: syntax error : missing ';' before '{'
1>d:\workplace\c++\imageprocess\imageprocess\ini\ini_file.hpp(9) : error C2447: '{' : missing function header (old-style formal list?)
1>d:\workplace\c++\imageprocess\imageprocess\ini\ini_file.hpp(17) : error C2065: 'Entry' : undeclared identifier

[解决办法]
感觉出错的不是在这里,虽然这里报错。例如,你 #include这个文件的前一个包含头文件有问题(如class少最后一个分号)

热点排行