syntax error : missing ';' before identifier
2024-08-27 22:51:29
原文解决方案
#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;
在你文件上方的某个地方声明它;
最新文章
- scikit-learn 和pandas 基于windows单机机器学习环境的搭建
- 安装ubuntu系统
- CodeForces #369 C. Coloring Trees DP
- android + javascript 相互通信实例分析
- RTP、RTCP
- phpstorm 配置
- css学习笔记1
- web page diagnostics
- Spring+Hibernate+Struts(SSH)框架整合
- Dynamic Web Module 3.0 requires Java 1.6 or newer.的解决
- 第二部分之AOF持久化(第十一章)
- jquery.ajax()详解
- Visual Studio 2017的一些使用记录
- 关于nexus的学习
- SSM项目layui分页实例
- SharePoint 2013 Step by Step——How to Create a Lookup Column to Another Site(Cross Site)
- CTF-i春秋网鼎杯第一场misc部分writeup
- angular之interceptors拦截器
- MVC中@Html.Action的用法
- pow(x,y)函数的实现算法(递归函数)
热门文章
- vue中minxin---小记
- View Controller Programming Guide for iOS---(一)---About View Controllers
- 每天一水poj1502【最短路】
- bzoj 3160: 万径人踪灭【FFT+manacher】
- IT兄弟连 JavaWeb教程 使用Java同步机制对多线程同步
- postman接口测试系列:环境配置
- 构造 Bubble Cup 8 - Finals D. Tablecity
- git简单使用方法
- 自己写的MD5加密原码
- JAVA常用设计模式(静态化调用和实例化调用的区别,编辑可见 )