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 ...
随机推荐
- Docker 概念及基本用法
Docker 概念及基本用法 一. 本节内容简介 本实验中我们初步接触Docker的概念和基本用法.需要依次完成下面几项任务: 理解Docker是什么 学习如何在Linux上安装Docker 学习如何 ...
- Oracle ORA-01033: ORACLE initialization or shutdown in progress 错误解决办法Windows版(手贱强制重启电脑的后果)
转自:https://blog.csdn.net/rrrrroy_ha/article/details/80601497
- Codechef WEASELSC
WEASELSC code 给定一个高度图 a[1..n] ,要求你减少图中一些地方的高度,使得得到的图是一个不超过 K 级的楼梯,要求楼梯的面积最大(即得到的图中所有位置的高度之和最大). 这题题面 ...
- B. Vanya and Books
time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...
- teamviewer被识别为商业用途
1.卸载teamviewer,在控制面板里或者用360等软件卸载: 2.删除下面两个目录 C:\Program Files (x86)\TeamViewer C:\Users\Administrato ...
- P5166 xtq的口令
传送门 这题要是搞懂在干什么其实不难(虽然某个花了几个小时才搞明白的家伙似乎没资格这么说--) 假设所有人都没有听到老师的命令,我们从左到右考虑,对于当前的人,如果它没有观察者,那么肯定要让它听到老师 ...
- 温习LOGO语言
LOGO是什么? LOGO语言是一种早期的编程语言,也是一种与自然语言非常接近的编程语言,它通过"绘图"的方式来学习编程,对初学者特别是儿童进行寓教于乐的教学方式. LOGO语言创 ...
- TC学习总结
带宽管理: TC中规定描述带宽: mbps = 1024 kbps = 1024 * 1024 bps => byte/s mbit = 1024 kbit => kilo bit/s m ...
- VS2008/2010 都不能使用Access2010数据库
VS2008/2010 都不能使用Access2010数据库,因为VS2008/2010都不能使用X64位的Access数据库引擎.
- Qt容器类之三:通用算法
在<QtAlgorithm>头文件中,Qt提供了一些全局的模板函数,这些函数是可以使用在容器上的十分常用的算法.我们可以在任何提供了STL风格迭代器的容器类上用这些算法,包括QList.Q ...