windows app

I am making a windows app but the compiler returns the errors while using cout:
I have using namespace std;
error C2143: syntax error : missing ';' before '<<' (no semicolon is missing)

error C4430: missing type specifier - int assumed. Note: C++ does not support default-int (how does that apply?)

error C2086: 'int cout' : redefinition

: see declaration of 'cout' why do i have to decalre cout? anyway here is the code segment

cout<<"message "<<variable<<endl;
cout<<"message: "<<variable<<endl;
cout<<"message: "<<variable<<endl;
cout<<"message: "<<variable/totalLine<<endl;
cout<<"message: "<<variable<<endl;
cout<<"message: "<<variable<<endl;
cout<<"message "<<variable<<endl;
cout<<"message: "<< variable <<'\n';
Last edited on
It seems that your a missing a semi-colon somewhere, which is screwing up succeeding statements.
it does seem that way but i have been over the code a million times. None missing. For all eight cout messages I get the same three errors and their are semi colon and the end of all those lines.
why don't you look at the code before those lines?
I have! A ton of times. If I take these out the gun runs. There must be a different way to put this into a windows app other than using cout<<
Do you have using namespace std;? If not, then you must fully qualify "cout" as std::cout. I would recommend not having using namespace <anything>; anyway; but this seems to be the mistake you've made.
Last edited on
thanks for replying. I do have using namespace std; do you think if i take it out and use the std::it would make a difference? Would having the both of them present a conflict?
I doubt it would help if you do, but like I said; I think you should use the std:: prefix anyway. It's useful for avoiding name errors and what-not. It takes a little getting used to, you have to remember what's in the std namespace and what isn't, but when you get used to it it's fine.
I will let you know how it turn out.
I tried dropping using namespace and used std:: instead. It opened the flood gates to alot of errors and I still got the three errors from first post hmmmmmm. I tried googling this too and it seems that others had this problem too but I cant seem to find a solution. I guess the better question would be what is the best way to display variable solution in the window once the program is exectuted?
Could you please post that code in the context it appears? Clearly that's not a single block; could you post the surrounding code, please?
sure
I pmed you so a whole bunch of people dont reply at the same time. I want to listen to one person at a time.
Topic archived. No new replies allowed.