How to find the "real" error?

I get a huge number of errors displayed in the list of program errors, but none of the above are โ€œrealโ€ errors. Some of the lines are red, and then when I go to highlight them, the error disappears. I just can't find where my mistake really is. What is the best way to go through to find my mistake?

The following is a list of errors, if useful.

Error 38 error C1004: unexpected end-of-file found 85 Error 68 error C1004: unexpected end-of-file found 42 Error 63 error C1903: unable to recover from previous error(s); stopping compilation 72 Error 66 error C2059: syntax error : ')' 42 Error 2 error C2059: syntax error : '>' 80 Error 40 error C2059: syntax error : '>' 80 Error 65 error C2059: syntax error : '>' 42 Error 20 error C2065: '_Ptr_cerr' : undeclared identifier 27 Error 16 error C2065: '_Ptr_cin' : undeclared identifier 25 Error 22 error C2065: '_Ptr_clog' : undeclared identifier 28 Error 18 error C2065: '_Ptr_cout' : undeclared identifier 26 Error 28 error C2065: '_Ptr_wcerr' : undeclared identifier 32 Error 24 error C2065: '_Ptr_wcin' : undeclared identifier 30 Error 30 error C2065: '_Ptr_wclog' : undeclared identifier 33 Error 26 error C2065: '_Ptr_wcout' : undeclared identifier 31 Error 4 error C2065: 'faction' : undeclared identifier 84 Error 42 error C2065: 'faction' : undeclared identifier 84 Error 64 error C2065: 'Faction' : undeclared identifier 42 Error 13 error C2065: 'socialite' : undeclared identifier 100 Error 51 error C2065: 'socialite' : undeclared identifier 100 Error 1 error C2065: 'Socialite' : undeclared identifier 80 Error 12 error C2065: 'Socialite' : undeclared identifier 100 Error 39 error C2065: 'Socialite' : undeclared identifier 80 Error 50 error C2065: 'Socialite' : undeclared identifier 100 Error 8 error C2065: 'textWriter' : undeclared identifier 82 Error 46 error C2065: 'textWriter' : undeclared identifier 82 Error 6 error C2143: syntax error : missing ',' before ')' 84 Error 10 error C2143: syntax error : missing ',' before ')' 82 Error 14 error C2143: syntax error : missing ',' before ')' 100 Error 44 error C2143: syntax error : missing ',' before ')' 84 Error 48 error C2143: syntax error : missing ',' before ')' 82 Error 52 error C2143: syntax error : missing ',' before ')' 100 Error 17 error C2143: syntax error : missing ',' before ';' 25 Error 19 error C2143: syntax error : missing ',' before ';' 26 Error 21 error C2143: syntax error : missing ',' before ';' 27 Error 23 error C2143: syntax error : missing ',' before ';' 28 Error 25 error C2143: syntax error : missing ',' before ';' 30 Error 27 error C2143: syntax error : missing ',' before ';' 31 Error 29 error C2143: syntax error : missing ',' before ';' 32 Error 31 error C2143: syntax error : missing ',' before ';' 33 Error 7 error C2143: syntax error : missing ';' before '{' 32 Error 15 error C2143: syntax error : missing ';' before '{' 10 Error 32 error C2143: syntax error : missing ';' before '{' 36 Error 35 error C2143: syntax error : missing ';' before '{' 27 Error 45 error C2143: syntax error : missing ';' before '{' 32 Error 54 error C2143: syntax error : missing ';' before '{' 34 Error 57 error C2143: syntax error : missing ';' before '{' 48 Error 60 error C2143: syntax error : missing ';' before '{' 61 Error 3 error C2143: syntax error : missing ';' before '}' 82 Error 11 error C2143: syntax error : missing ';' before '}' 98 Error 33 error C2143: syntax error : missing ';' before '}' 42 Error 34 error C2143: syntax error : missing ';' before '}' 45 Error 36 error C2143: syntax error : missing ';' before '}' 83 Error 37 error C2143: syntax error : missing ';' before '}' 85 Error 41 error C2143: syntax error : missing ';' before '}' 82 Error 49 error C2143: syntax error : missing ';' before '}' 98 Error 55 error C2143: syntax error : missing ';' before '}' 43 Error 58 error C2143: syntax error : missing ';' before '}' 57 Error 61 error C2143: syntax error : missing ';' before '}' 69 Error 67 error C2143: syntax error : missing ';' before '}' 42 Error 5 error C2275: 'Faction' : illegal use of this type as an expression 84 Error 43 error C2275: 'Faction' : illegal use of this type as an expression 84 Error 9 error C2275: 'std::ofstream' : illegal use of this type as an expression 82 Error 47 error C2275: 'std::ofstream' : illegal use of this type as an expression 82 Error 53 error C2653: 'Socialite' : is not a class or namespace name 33 Error 56 error C2653: 'Socialite' : is not a class or namespace name 46 Error 59 error C2653: 'Socialite' : is not a class or namespace name 60 Error 62 error C2653: 'Socialite' : is not a class or namespace name 72 
+4
source share
5 answers

Probably absent; after closing} class / structure. Could you post the code?

UPDATE: the code compiles on my gcc. I found that you have a circular dependency between your classes. So allow it, forward declare some of them in the headings. I added class Faction; before class Socialite in Socialite.h and class Socialite; before class Faction in Faction.h .

+6
source

The unexpected end of the file is usually that you are missing a closing "something", such as a bracket } or a bracket )

+1
source

It is either missing #endif , or ; at the end of the type definition or possibly missing } at the end of the function.

0
source

Start with the first error recorded. This is often the cause of many subsequent problems because the first error causes the parser to not synchronize with the rest of the code.

In C ++, long cascades of errors are often caused by an undeclared type (did you forget the include file?) Or missing ; after defining a class or structure.

Consider:

 Foobar fb; // Declare an instance of Foobar. 

If Foobar has not yet been declared (perhaps because you forgot to include "foobar.h"), the compiler might think that you are trying to declare a variable named Foobar with the default int type. From there, he sees fb and gets confused.

Or consider:

 struct Foobar { int x; int y; } int blah = 0; 

Without ; after determining the structure, the analyzer considers that you are trying to declare an Foobar instance with the name int, which is unacceptable, since int is a reserved keyword. And everything after that looks like a gobbledegook for the compiler.

One trick - temporarily #if 0 - is all the code after the line with the first error reported, as this will reduce noise until you isolate the original problem.

0
source

If you look in the Error List window (View> Error List), it will be difficult to determine where errors occur. Fortunately, there is another way:

  • Open the "Exit" window (debug> Windows> Exit)
  • Compile and build
  • Start at the top of the Exit window and navigate your way through the output of the compiler / linker until you go to the first line that says โ€œerrorโ€

This will lead you to a problem.

0
source

Source: https://habr.com/ru/post/1484513/


All Articles