Skip to main content
The 2024 Developer Survey results are live! See the results

Just start addressing the errors one by one. A lot of the errors are just cascaded from the initial errors, so it looks like there are a lot of problems when there's only a couple. Just start from the top:

1>.\test.cpp(15) : error C2864: 'Tester::number' : only static const integral data members can be initialized within a class

You can't initialize a member in the class definition unless it's static, const, and an integer typeone of the integral types. Leave the "= 5" off of the declaration of number. Then you'll need to have a definition of Tester::number outside of the class definition, like so:

int Tester::number = 5;

Problem #2:

1>.\test.cpp(33) : error C2146: syntax error : missing ';' before identifier 'testerObject'

Almost exactly what it says (missing semi-colon errors can be a bit inexact in saying where the semicolon should be) - you need a semi-colon after the definition of the Tester class.

Fix those and your compilation problems go away.

The key thing is to try and take compiler errors one at a time from the top. If you get more than about 3 of them, you can probably just ignore everything after the 3rd or so because the initial error just cause the compile to into the weeds (and if they are real errors, they'll show up again in the next compile anyway).

Just start addressing the errors one by one. A lot of the errors are just cascaded from the initial errors, so it looks like there are a lot of problems when there's only a couple. Just start from the top:

1>.\test.cpp(15) : error C2864: 'Tester::number' : only static const integral data members can be initialized within a class

You can't initialize a member in the class definition unless it's static, const, and an integer type. Leave the "= 5" off of the declaration of number. Then you'll need to have a definition of Tester::number outside of the class definition, like so:

int Tester::number = 5;

Problem #2:

1>.\test.cpp(33) : error C2146: syntax error : missing ';' before identifier 'testerObject'

Almost exactly what it says (missing semi-colon errors can be a bit inexact in saying where the semicolon should be) - you need a semi-colon after the definition of the Tester class.

Fix those and your compilation problems go away.

The key thing is to try and take compiler errors one at a time from the top. If you get more than about 3 of them, you can probably just ignore everything after the 3rd or so because the initial error just cause the compile to into the weeds (and if they are real errors, they'll show up again in the next compile anyway).

Just start addressing the errors one by one. A lot of the errors are just cascaded from the initial errors, so it looks like there are a lot of problems when there's only a couple. Just start from the top:

1>.\test.cpp(15) : error C2864: 'Tester::number' : only static const integral data members can be initialized within a class

You can't initialize a member in the class definition unless it's static, const, and one of the integral types. Leave the "= 5" off of the declaration of number. Then you'll need to have a definition of Tester::number outside of the class definition, like so:

int Tester::number = 5;

Problem #2:

1>.\test.cpp(33) : error C2146: syntax error : missing ';' before identifier 'testerObject'

Almost exactly what it says (missing semi-colon errors can be a bit inexact in saying where the semicolon should be) - you need a semi-colon after the definition of the Tester class.

Fix those and your compilation problems go away.

The key thing is to try and take compiler errors one at a time from the top. If you get more than about 3 of them, you can probably just ignore everything after the 3rd or so because the initial error just cause the compile to into the weeds (and if they are real errors, they'll show up again in the next compile anyway).

added 332 characters in body
Source Link
Michael Burr
  • 337.9k
  • 50
  • 546
  • 768

Just start addressing the errors one by one. A lot of the errors are just cascaded from the initial errors, so it looks like there are a lot of problems when there's only a couple. Just start from the top:

1>.\test.cpp(15) : error C2864: 'Tester::number' : only static const integral data members can be initialized within a class

You can't initialize a member in the class definition unless it's static, const, and an integer type. Leave the "= 5" off of the declaration of number. Then you'll need to have a definition of Tester::number outside of the class definition, like so:

int Tester::number = 5;

Problem #2:

1>.\test.cpp(33) : error C2146: syntax error : missing ';' before identifier 'testerObject'

Almost exactly what it says (missing semi-colon errors can be a bit inexact in saying where the semicolon should be) - you need a semi-colon after the definition of the Tester class.

Fix those and your compilation problems go away.

The key thing is to try and take compiler errors one at a time from the top. If you get more than about 3 of them, you can probably just ignore everything after the 3rd or so because the initial error just cause the compile to into the weeds (and if they are real errors, they'll show up again in the next compile anyway).

Just start addressing the errors one by one. A lot of the errors are just cascaded from the initial errors, so it looks like there are a lot of problems when there's only a couple. Just start from the top:

1>.\test.cpp(15) : error C2864: 'Tester::number' : only static const integral data members can be initialized within a class

You can't initialize a member in the class definition unless it's static, const, and an integer type. Leave the "= 5" off of the declaration of number. Then you'll need to have a definition of Tester::number outside of the class definition, like so:

int Tester::number = 5;

Problem #2:

1>.\test.cpp(33) : error C2146: syntax error : missing ';' before identifier 'testerObject'

Almost exactly what it says (missing semi-colon errors can be a bit inexact in saying where the semicolon should be) - you need a semi-colon after the definition of the Tester class.

Fix those and your compilation problems go away.

Just start addressing the errors one by one. A lot of the errors are just cascaded from the initial errors, so it looks like there are a lot of problems when there's only a couple. Just start from the top:

1>.\test.cpp(15) : error C2864: 'Tester::number' : only static const integral data members can be initialized within a class

You can't initialize a member in the class definition unless it's static, const, and an integer type. Leave the "= 5" off of the declaration of number. Then you'll need to have a definition of Tester::number outside of the class definition, like so:

int Tester::number = 5;

Problem #2:

1>.\test.cpp(33) : error C2146: syntax error : missing ';' before identifier 'testerObject'

Almost exactly what it says (missing semi-colon errors can be a bit inexact in saying where the semicolon should be) - you need a semi-colon after the definition of the Tester class.

Fix those and your compilation problems go away.

The key thing is to try and take compiler errors one at a time from the top. If you get more than about 3 of them, you can probably just ignore everything after the 3rd or so because the initial error just cause the compile to into the weeds (and if they are real errors, they'll show up again in the next compile anyway).

Source Link
Michael Burr
  • 337.9k
  • 50
  • 546
  • 768

Just start addressing the errors one by one. A lot of the errors are just cascaded from the initial errors, so it looks like there are a lot of problems when there's only a couple. Just start from the top:

1>.\test.cpp(15) : error C2864: 'Tester::number' : only static const integral data members can be initialized within a class

You can't initialize a member in the class definition unless it's static, const, and an integer type. Leave the "= 5" off of the declaration of number. Then you'll need to have a definition of Tester::number outside of the class definition, like so:

int Tester::number = 5;

Problem #2:

1>.\test.cpp(33) : error C2146: syntax error : missing ';' before identifier 'testerObject'

Almost exactly what it says (missing semi-colon errors can be a bit inexact in saying where the semicolon should be) - you need a semi-colon after the definition of the Tester class.

Fix those and your compilation problems go away.