注册 登录
编程论坛 C++教室

C++中编译通过的程序拷进MFC咋就不能用了?

毕业旅行 发布于 2010-08-23 11:06, 924 次点击
我觉得是string的问题,但是不知道咋修改。。
我在对话框里添加了两个函数
格式是这样的string calculate(string str){…………}
            string bracket(string str){…………}
下面是报错。

d:\应用程序编程\ex_24\ex_24dlg.h(18) : error C2146: syntax error : missing ';' before identifier 'bracket'
d:\应用程序编程\ex_24\ex_24dlg.h(18) : error C2501: 'string' : missing storage-class or type specifiers
d:\应用程序编程\ex_24\ex_24dlg.h(18) : error C2061: syntax error : identifier 'string'
d:\应用程序编程\ex_24\ex_24dlg.h(19) : error C2146: syntax error : missing ';' before identifier 'calculate'
d:\应用程序编程\ex_24\ex_24dlg.h(19) : error C2501: 'string' : missing storage-class or type specifiers
d:\应用程序编程\ex_24\ex_24dlg.h(19) : error C2061: syntax error : identifier 'string'
EX_24Dlg.cpp
d:\应用程序编程\ex_24\ex_24dlg.h(18) : error C2146: syntax error : missing ';' before identifier 'bracket'
d:\应用程序编程\ex_24\ex_24dlg.h(18) : error C2501: 'string' : missing storage-class or type specifiers
d:\应用程序编程\ex_24\ex_24dlg.h(18) : error C2061: syntax error : identifier 'string'
d:\应用程序编程\ex_24\ex_24dlg.h(19) : error C2146: syntax error : missing ';' before identifier 'calculate'
d:\应用程序编程\ex_24\ex_24dlg.h(19) : error C2501: 'string' : missing storage-class or type specifiers
d:\应用程序编程\ex_24\ex_24dlg.h(19) : error C2061: syntax error : identifier 'string'
D:\应用程序编程\EX_24\EX_24Dlg.cpp(217) : error C2143: syntax error : missing ';' before 'tag::id'
D:\应用程序编程\EX_24\EX_24Dlg.cpp(217) : error C2501: 'string' : missing storage-class or type specifiers
D:\应用程序编程\EX_24\EX_24Dlg.cpp(217) : fatal error C1004: unexpected end of file found
1 回复
#2
毕业旅行2010-08-23 11:46
研究了很久。。。搞定了

刚才头文件位置一直加的不对,要加在类的定义的那个文件里,呵呵
1