C++ 编译不存在的行上的错误。如何使重启功能
C++ Compile errors on lines that don't exsist. How to make restart function
当我编译这段代码时,我得到我得到编译错误:代码下面的错误。
#include <iostream>
using namespace std;
int main()
{
while (true)
{
int go_again;
go_again = 0;
//[CODE HERE STARTS THREADS] Removed because it was unnecessary
while (true)
{
if ((GetAsyncKeyState(Settings()->exit_key)) // exits programm
{
go_again = 1;
exit(0);
}
if ((GetAsyncKeyState(Settings()->restart)) // restarts programm
{
exit(0);
}
else
{
Sleep(100);
}
}
if (go_again == 1)
{
exit(0);
}
}
return 0;
}
下面是一些错误:
main.cpp(323) : Empty Attribute block is not allowed.
main.cpp(323) : Syntax error: Missing ']' before /
main.cpp(323) : Empty Attribute block is not allowed.
main.cpp(468) : Sytax error: missing ']' before '/'.
main.cpp(468) : Sytax error: missing ';' before '/'.
main.cpp(468) : Sytax error: missing ';' before '{'.
编辑:关于错误的另一个奇怪的事情是它说它在不存在的行上,因为只有100行代码,但它说错误在第468行等等。我正在使用自定义版本的visual c++编译器。
还有更多,但从错误的数量来判断,似乎我一直在做重启功能错误。有人知道正确的方法来做一个重启函数和停止函数的代码?我是c++的新手,所以我不太习惯语法。
if语句中缺少')',第一行只是注释;)
相关文章:
- 如何将stdout重定向到stderr
- 以编程方式防止重命名或删除文件,但仍使其可写
- C++Linux服务-如何使用init.d+自动重启
- 如何使具有许多全局变量的旧C代码库可重入
- 创建一个可以在使用时重命名的文件
- 递归重启循环 (C++)
- 为什么在流中插入会使其宽度重置为 0
- 如何将windows服务用作崩溃重启程序
- 频繁暂停和重启线程的最佳方法是什么?
- 正在重启RPC服务
- Cocos2dx重启场景崩溃CCTextureCache
- 暂停游戏时,进入前台,重启后
- C++ 编译不存在的行上的错误。如何使重启功能
- 如何重启boost::timer::cpu_timer
- 检测系统重启并启动应用程序
- 如何在vc++中延迟windows 7或windows 8的关机/重启/休眠
- C++11编译器何时会使RVO和NRVO优于移动语义和常量引用绑定
- 我想在系统重启时重新启动我的应用程序
- 为什么重启后串口读取不工作
- 系统()调用批处理可执行流文件使程序在windows上重置