Sign in with
Sign up | Sign in
Your question

C++ codeblocks problem

Last response: in Applications
Share
October 16, 2012 9:10:56 PM

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

More about : codeblocks problem

October 16, 2012 9:38:45 PM

You're going to slap yourself on the forehead when you see how simple a mistake you made

  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. int main(){
  6. cout << "Hello world!\n";
  7. cout << "Nice job Giannis";
  8.  
  9. return 0;
  10. }


You had quotes around iostream instead of the greater/less than signs.
m
0
l
October 17, 2012 12:33:19 AM

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
m
0
l
Related resources
a b L Programming
October 17, 2012 7:43:26 AM

I'd reinstall the compiler. Looks broken to me.
m
0
l
a b L Programming
October 17, 2012 8:10:16 AM

There is some problem with the project settings that is preventing it finding the required libraries. Have a read of: http://wiki.codeblocks.org/index.php?title=FAQ-Compilin...(errors)#Q:_My_build_fails_with_multiple_undefined_reference_errors.3F and check the linker options.
m
0
l
October 17, 2012 9:34:47 AM

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...
m
0
l
a b L Programming
October 17, 2012 10:05:06 AM

Glad you solved it :D 
m
0
l
a b L Programming
October 17, 2012 10:20:33 AM

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.
m
0
l
October 17, 2012 12:31:56 PM

i want to ask one thing more...

is there any command like cin.get() for intiger?
m
0
l
a b L Programming
October 17, 2012 2:49:50 PM

Ijack said:
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.


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

johnara1993 said:
i want to ask one thing more...

is there any command like cin.get() for intiger?


Just use operator >>. Like this:

  1. int a;
  2. cin >> a;
m
0
l
October 17, 2012 3:16:50 PM

i want something like this but for a intiger

  1. char c;
  2. while( (cin.get(c)) ) {
  3. }


so it stops when there is nothing to give in cin
m
0
l
a b L Programming
October 17, 2012 3:21:31 PM

  1. int a;
  2. while (!cin.fail())
  3. {
  4. cin >> a;
  5. }
m
0
l
a b L Programming
October 17, 2012 4:16:02 PM

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

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.
m
0
l
a b L Programming
October 17, 2012 6:33:52 PM

Hmm, doesn't GCC stand for GNU C Compiler and G++ for GNU C++ Compiler?
m
0
l
a b L Programming
October 17, 2012 7:21:19 PM

No. GCC stands for the Gnu Compiler Collection. It compiles several languages other than C.

http://gcc.gnu.org/
m
0
l
!