-1

When I compile this code I get I get Compilation errors: Errors below code.

#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;
}

Here are just some of the Errors:

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 '{'.

EDIT: Another weird thing about the errors is its saying its on lines that don't exists, as there is only 100 lines of code, yet this says the errors are on line 468 etc. I am using custom version of visual c++ compiler.

There are alot more, but judging by the amount of errors, it seams that I have been doing the restart function wrong. Does anyone know the correct way to do a restart function and a stop function for the code? I am new to C++ so I am not that used to the syntax.

J Doggy
  • 11
  • 2
    Are we supposed to guess which line is line #323, and which one is #468? – Sam Varshavchik Sep 28 '16 at 01:18
  • ***I am using custom version of visual c++ compiler.*** Maybe that is the real problem. – drescherjm Sep 28 '16 at 01:33
  • ***it seams that I have been doing the restart function wrong*** `Settings()->restart)` is not a function call! – drescherjm Sep 28 '16 at 01:34
  • @SamVarshavchik If you read the question, it says that main.cpp is only around 100 lines of code. This means line 343 and 468 don't exist. – J Doggy Sep 28 '16 at 01:34
  • @drescherjm It is cause I included it, (removed almost all of the code otherwise I couldn't post on stack overflow.) The custom compiler is basically the visual c++ compiler so it shouldn't be the compiler. – J Doggy Sep 28 '16 at 01:37
  • Ok, I read the question. Here's what I read: "Sytax error: missing ']' before '/'." -- do you maintain that this is a real compiler error message, including the misspelling? – Sam Varshavchik Sep 28 '16 at 01:37
  • The reason I suspect the "custom" compiler is the problem is you said it is returning line numbers that don't exist. I mean: ***there is only 100 lines of code, yet this says the errors are on line 468*** – drescherjm Sep 28 '16 at 01:38
  • Ill run it through a non custom visual C++ compiler to see which lines the syntax errors are on. – J Doggy Sep 28 '16 at 01:45
  • I'm sorry, but would you care to explain what a "custom visual C++ compiler" is again? Your explanation above makes no sense whatsoever. – Carey Gregory Sep 28 '16 at 01:49
  • The compiler adds junk lines of code, than changes syntax. It does this to change the signature of the software so it doesn't get detected by game anti cheat systems. – J Doggy Sep 28 '16 at 01:58
  • 2
    @JDoggy: That's where your offset lines are coming from then. – Joshua Sep 28 '16 at 02:35
  • 2
    LOL, seriously? You're using a malware compiler and you're asking us where mysterious line numbers come from? You're missing some parentheses in the code you posted, as the answer by @skullpand4 already told you. So accept skullpad's answer, upvote it, and move on before your question gets closed. – Carey Gregory Sep 28 '16 at 04:34

1 Answers1

3

Missing ')' in your if statement, line a just comments ;)

skullpand4
  • 31
  • 3
  • This does not provide an answer to the question. Once you have sufficient [reputation](http://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](http://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](http://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/low-quality-posts/13815151) – Toby Speight Sep 28 '16 at 08:26
  • @TobySpeight It precisely answers the question. It may not be the most eloquent answer but it's exactly what's wrong with the OP's code. – Carey Gregory Sep 28 '16 at 21:39