Oh, my bad. I must have problems reading
Oh, my bad. I must have problems reading
Not <string.h> for the string class, just <string>. No standard C++ headers end in .h.
c:\program files\microsoft visual studio\myprojects\hangman\hangman.h(4) : error C2146: syntax error : missing ';' before identifier 'word'
c:\program files\microsoft visual studio\myprojects\hangman\hangman.h(4) : error C2501: 'string' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\myprojects\hangman\hangman.h(4) : error C2501: 'word' : missing storage-class or type specifiers
You have a missing ; and then something about "missing storage-class" (sorry, don't know about this one).
The rest of the errors just occur because of the first ones. Fix the first error, and the other 100 will also disappear (magic ).
Why is the struct extern? You are not linking the header file, you include it in your main program.
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.
These too are tied together for a reason. The compiler is not recognizing string as a valid type therefore it thinks that is a variable name with no type definition(storage class). The missing ; is because of how you declare variables, aka int a;char b; //ect.You have a missing ; and then something about "missing storage-class" (sorry, don't know about this one).
Thx everyone. I don't know if any of that will fix the problem yet, but I'm gonna try it out.
As for the 'extern', I was having linking errors b4 and someone told me to use that. If I should take it out what would i do to fix the linking errors?
Hey, you gotta start somewhere
Thx everyone. I don't know if any of that will fix the problem yet, but I'm gonna try it out.
As for the 'extern', I was having linking errors b4 and someone told me to use that. If I should take it out what would i do to fix the linking errors?
Hey, you gotta start somewhere
These are the errors i get when i take out the 'extern' and all that stuff:
Check out all my source code on the first page if u need any more info and once again thx a lot 4 your help even though it's all 4 a hangman game... it's a learning experience i guess you could sayCode:--------------------Configuration: Hangman - Win32 Debug-------------------- Compiling... Hangman.cpp Main.cpp Linking... Main.obj : error LNK2005: "struct hangman hang" (?hang@@3Uhangman@@A) already defined in Hangman.obj Debug/Hangman.exe : fatal error LNK1169: one or more multiply defined symbols found Error executing link.exe. Hangman.exe - 2 error(s), 0 warning(s)
Hey, you gotta start somewhere
It turns out to be a big problem ....
Please tell us about the resulte....
LQQK, Please I want you to check if you realy have string.h in your lib files.... : COULD YOU PLEASE TRY TO WRITE ANOTHER SMALL PROGRAM .. AND INCLUDE STRINGS.H AND TRY TO COMPILE IT ... FOR EXAMPLE:
If you got the same problem, that means that you have problem with your ver. of C++...Code:# include<iostream>; #include<strings.h>; int main() { string str1= " this is a string"; cout<< str1<<endl; cout<< "let me know what happend.?" return 0; }
C++
The best
s***....
From this code
I get these errorsCode:#include<iostream> #include<string.h> int main() { string str1= " this is a string"; cout<< str1<<endl; cout<< "let me know what happend.?" return 0; }
wtf is wrong?Code:--------------------Configuration: Testing - Win32 Debug-------------------- Compiling... main.cpp c:\program files\microsoft visual studio\myprojects\testing\main.cpp(6) : error C2065: 'string' : undeclared identifier c:\program files\microsoft visual studio\myprojects\testing\main.cpp(6) : error C2146: syntax error : missing ';' before identifier 'str1' c:\program files\microsoft visual studio\myprojects\testing\main.cpp(6) : error C2065: 'str1' : undeclared identifier c:\program files\microsoft visual studio\myprojects\testing\main.cpp(6) : error C2440: '=' : cannot convert from 'char [18]' to 'int' This conversion requires a reinterpret_cast, a C-style cast or function-style cast c:\program files\microsoft visual studio\myprojects\testing\main.cpp(7) : error C2065: 'cout' : undeclared identifier c:\program files\microsoft visual studio\myprojects\testing\main.cpp(7) : error C2065: 'endl' : undeclared identifier c:\program files\microsoft visual studio\myprojects\testing\main.cpp(7) : warning C4552: '<<' : operator has no effect; expected operator with side-effect c:\program files\microsoft visual studio\myprojects\testing\main.cpp(10) : error C2297: '<<' : illegal, right operand has type 'char [27]' c:\program files\microsoft visual studio\myprojects\testing\main.cpp(10) : error C2143: syntax error : missing ';' before 'return' Error executing cl.exe. Testing.exe - 8 error(s), 1 warning(s)
Hey, you gotta start somewhere
btw i don't know if i mentioned it but i have visual c++ 6.0
Hey, you gotta start somewhere
I will try to test it right now and I will tell you what is going onnnnnnnnnnnn
hmmmmmmmmmmmmmmm..............
C++
The best
Try this now...
I hope you got something out of it.Code:#include<iostream.h> #include<string> int main() { string str1= " this is a string"; cout<< str1<<endl; cout<< "let me know what happend.?"; return 0; }
C++
The best
nope... same thing.
The strings used to work, so how come they don't work anymore?
Hey, you gotta start somewhere
Does it work or it doesn;t
I could'nt understand...
if not please post your error message...
C++
The best
it doesn't work
it gives me pretty much the same errors as b4.
it has no idea what a string is for some reason.
how can i fix this problem?
Hey, you gotta start somewhere