| gcarlson53 (9) | |||
I don't know what is wrong with this. And the IDE I'm using is Visual Studio 2008.
| |||
|
|
|||
| Zhuge (2471) | |
| What are the errors? Apologies but you probably won't find many people who will compile the code for you just to see what the problems are. | |
|
|
|
| gcarlson53 (9) | |
|
error C2040: '==' : 'int' differs in levels of indirection from 'const char [2]' I have like 17 of these errors. | |
|
|
|
| gcarlson53 (9) | |||
My 15 errors are: 1>.\carlson_Lab4_Ex3.cpp(115) : error C2440: 'initializing' : cannot convert from 'const char [2]' to 'char' 1>.\carlson_Lab4_Ex3.cpp(116) : error C2440: 'initializing' : cannot convert from 'const char [2]' to 'char' 1>.\carlson_Lab4_Ex3.cpp(118) : error C2446: '==' : no conversion from 'const char *' to 'int' 1>.\carlson_Lab4_Ex3.cpp(118) : error C2040: '==' : 'int' differs in levels of indirection from 'const char [2]' 1>.\carlson_Lab4_Ex3.cpp(118) : error C2446: '==' : no conversion from 'const char *' to 'int' 1>.\carlson_Lab4_Ex3.cpp(118) : error C2040: '==' : 'int' differs in levels of indirection from 'const char [2]' 1>.\carlson_Lab4_Ex3.cpp(121) : error C2446: '==' : no conversion from 'const char *' to 'int' 1>.\carlson_Lab4_Ex3.cpp(121) : error C2040: '==' : 'int' differs in levels of indirection from 'const char [2]' 1>.\carlson_Lab4_Ex3.cpp(127) : error C2446: '==' : no conversion from 'const char *' to 'int' 1>.\carlson_Lab4_Ex3.cpp(127) : error C2040: '==' : 'int' differs in levels of indirection from 'const char [2]' 1>.\carlson_Lab4_Ex3.cpp(127) : error C2446: '==' : no conversion from 'const char *' to 'int' 1>.\carlson_Lab4_Ex3.cpp(127) : error C2040: '==' : 'int' differs in levels of indirection from 'const char [2]' 1>.\carlson_Lab4_Ex3.cpp(135) : error C2446: '==' : no conversion from 'const char *' to 'int' 1>.\carlson_Lab4_Ex3.cpp(135) : error C2040: '==' : 'int' differs in levels of indirection from 'const char [2]' 1>.\carlson_Lab4_Ex3.cpp(139) : error C2440: '=' : cannot convert from 'const char [2]' to 'char' | |||
|
|
|||
| gcampton (859) | |
|
line 16: void hit(int &); line 44: hit(person); then line 115: char hit = "y"; | |
|
|
|
| gcampton (859) | |
|
basically you have a function called hit, and your declaring a char called hit... won't work. call it something else... with errors, always ignore all the other errors after the first, just look at the first few lines of errors, have a look at the first line number and go to that line... in this case line 115. then try and determine why it thinks hit is a pointer to int. errors on lines 116-139 are redundant and are simply a result of this mismatch of names, if you change the name on the line causeing the problem (115) then the other errors dissapear. | |
|
Last edited on
|
|
| gcarlson53 (9) | |
| Now my function name is hit and the variable name is playerHit but I'm still getting the same 15 error messages | |
|
|
|
| gcarlson53 (9) | |||
My program finally runs but there is something wrong with the hit function because it never asks me if i want to hit or not. Here is my current code:
| |||
|
|
|||