expected type "<name>" defined at <line#> found type "<name>"

5
Mar

This error should be self explanatory. It is actually extremely helpful in comparison to most of the other languages I've worked with. It tells you exactly the type you used and the type you should have used.

In most other languages, many types are interchangeable, especially numbers: integers and floating points. In C/C++ one can write: a = b; to assign b to a where a and b are two completely different types such as int and double. Some compilers may warn you about the loss of precision (doubles can be too large to fit an integer.)

Review your code and adjust it as necessary. It could be that you used the wrong variable, so don't just cast or qualify your expressions so it compiles. Verify that the code is indeed correct first.

0
Your rating: None