C++ codeblocks problem

johnara1993

Honorable
Oct 16, 2012
5
0
10,510
Hi

i have installed the codeblocks-10.05mingw-setup.exe for wibdows 7 64bit and i using it for c++ programing but it can't compile

one month ago it was working perfect but now not

here is the code

[ code ]
#include"iostream"
using namespace std;


int main(){
cout << "Hello world!\n";
cout << "Nice job Giannis";

return 0;
}
[ /code ]

and here is the errors http://imageshack.us/a/img651/4581/errorsls.jpg
 

cl-scott

Honorable
Jul 5, 2012
145
0
10,660
You're going to slap yourself on the forehead when you see how simple a mistake you made

Code:
#include <iostream>
using namespace std;


int main(){
cout << "Hello world!\n";
cout << "Nice job Giannis";

return 0;
}

You had quotes around iostream instead of the greater/less than signs.
 

johnara1993

Honorable
Oct 16, 2012
5
0
10,510
nope same problem... i even copy paste your code and in compile i have the same problem again

i don't thing that i have an error in the code because with other codes one month ago i wasn't have any problem and now i have without edit them...

btw i slap myself xD
 

johnara1993

Honorable
Oct 16, 2012
5
0
10,510
how idiot a man could be...??? i thing that the answer to that question is me...
i use for compile gcc and not g++

ok problem solved

thank you all for your help and your time...
 

Ijack

Distinguished
Interesting. As far as I am aware, the "gcc" command should compile .cpp files without any problem. "g++" calls exactly the same back-end compiler but with different arguments. This would explain your problem; it obviously supplies a different default library list.
 

Sunius

Distinguished
Dec 19, 2010
390
0
19,060


gcc tries to compile code as C, while g++ compiles it as C++.



Just use operator >>. Like this:

Code:
int a;
cin >> a;
 

Ijack

Distinguished

I don't believe that is true. You must distinguish between the process of compilation to an object file from the process of linking. The problem here was at the linking stage, not the compilation one.