syntax error : missing ';' before identifier
原文解决方案
#include "string.h"
#include "stdafx.h"
#include "Chapter 01 MyVersion.h"
#include "cGameError.h
class cGameError
{
string m_errorText;
public:
cGameError( char *errorText )
{
DP1("***\n*** [ERROR] cGameError thrown! text: [%s]\n***\n",
errorText );
m_errorText = string( errorText );
}
const char *GetText()
{
return m_errorText.c_str();
}
};
enum eResult
{
resAllGood = 0, // function passed with flying colors
resFalse = 1, // function worked and returns 'false'
resFailed = –1, // function failed miserably
resNotImpl = –2, // function has not been implemented
resForceDWord = 0x7FFFFFFF
};
解决方案:include <string> 替换 include "string.h"
在c++中,include "string.h" 是标准C的头文件
<string>是c++头文件,里面定义了string类;
你也可以通过使用指定命名空间的方式来使用string类:
std::string m_errorText;
或者通过使用
using namespace std;
在你文件上方的某个地方声明它;
syntax error : missing ';' before identifier的更多相关文章
- c++,函数名不要和某个类名相同 (syntax error : missing ';' before identifier....)
直接上代码: // outside.h class Outside { private: class Inner { public: Inner(Outside& out) : out_(ou ...
- syntax error: missing ';' before identifier 'IWebBrowser'
遇到这个错误. google的结果是 去掉 WIN32_LEAN_AND_MEAN 宏定义 然而由于项目中使用了很多第三方库, 如果去掉这个宏, 会导致其他项目编译错了. 关于这个宏有什么用, 可以百 ...
- C++ 编译发现 error C2146: syntax error : missing ';' before identifier 'm_ctrlserver'
解决这个问题的根源是重复包含了头文件
- Visual studio 之常见编译错误(1):syntax error : missing ';' before identifier 'PVOID64'
来自博客:http://blog.csdn.net/chenyusiyuan/article/details/4643313的总结: 一般可通过调整 DirectShow/Include 在 Tool ...
- error C2143: syntax error : missing ';' before 'type'
许久之前,就想看看C和C++,看看这两种神奇的编程语言,但是一直被这样或者那样的琐事给耽搁了(狂喷自己的拖延症). 今天翻开自己的移动硬盘找到一本古老的书籍:<The C Programming ...
- error C2143: syntax error : missing ';' before '}'
今天弄Tab控件,干了一件非常愚蠢的事,没有去声明头文件.这也是今天要记录的问题,提示如下各种 前面一个符号是错误的.如果初学者遇到,算作一个提示,记得声明新类的.h 头文件 标签空间再进一步.cpp ...
- Syntax error missing ; before *
[问题] I have a header file like so: #pragma once #include "gamestate.h" #include "Ex ...
- VC++中编译C出错:error C2143: syntax error : missing ';' before 'type'
转摘自:http://preceo.blog.51cto.com/6225017/1130931 近来写程序时发现了一个问题,用 VC 编译 C语言是 总是提示一个错误:error C2143: sy ...
- Python3.x运行Python2.x代码报错 syntax error "Missing parentheses in call to 'print'
#另外一种错误 SyntaxError: Missing parentheses in call to 'print'. Did you mean print( 查看代码,格式如下: print &q ...
随机推荐
- 【旧文章搬运】再谈隐藏进程中的DLL模块
原文发表于百度空间,2009-09-17========================================================================== 相当老的话 ...
- [转载]挂接缓存管理器CcMapData()实现文件XX
原作者Azy,发表于DebugMan论坛. ======================================================= 这个方法的最大好处在于简单~~不用分别处理~ ...
- InstallShield 12 豪华版+破解版 下载
InstallShield 12 豪华版+破解版 下载 2009-07-09 19:18:30| 分类: 默认分类|字号 订阅 InstallShield 12 豪华版+破解版 下载 下载方 ...
- Linux学习—退出vi编辑模式
转载自:http://blog.csdn.net/u010648555/article/details/50676647 初学Linux的时候,在使用vi 操作时候,有时候可能进入的是一个文件夹,这样 ...
- java web url编码解码问题(下载中文名文件)
问题描述:需要url直接访问中文名的文件,类似于在地址栏里直接输入http://localhost:8080/example/丽江旅游攻略.doc 来进行文件下载,tomcat的server.xml文 ...
- PaaS服务之路漫谈(二)
此文已由作者尧飘海授权网易云社区发布. 欢迎访问网易云社区,了解更多网易技术产品运营经验. 天下大势,分久必合,合久必分,社会历史的发展方向总有着惊人的相似.把这种规律应用到软件应用架构的发展方向上, ...
- 51nod1432【贪心】
对于每个数我找一个和他相加最接近独木舟,然后ans+=1; 想复杂了,直接两端来就好了. 然后两个相加如果<=m那么就让它们在一起,不是的话就让大的一艘船,然后继续搞(贪心) #include ...
- redis 发布订阅实现异步实时发短信
redis 中发布和订阅可以实现消息的实时传输,这里我只是用它的事件驱动,当客户端发送了消息,服务器端立马可以接收指令处理相应的业务逻辑. 客户端 client.php <?php //发布 $ ...
- 鸟哥私房菜基础篇:Linux 档案与目录管理习题
猫宁!!! 参考链接:http://linux.vbird.org/linux_basic/0220filemanager.php 鸟哥是为中国信息技术发展做出巨大贡献的人. 1-什么是绝对路径与相对 ...
- SQL中进行转列的几种方式
SQL中进行转列 在很多笔试的程序员中会有很多写SQL的情况,其中很多时候会考察行转列.那么这个时候如果能写出来几种行转列的SQL,会给面试官留下比较好的印象. 以下是这次sql转换的表结构以及数据 ...