Code::blocks compilation error
I'm new to this editor, i used Dev-Cpp, and i heard this is a better tool to program with. Problem is that Code::blocks wont compile this:
#include <stream.h>
main ()
{
cout << "Hello world!\n";
}
I switched to Code::blocks mainly because i'm using linux and i cannot (read: don't want to) complicate with Dev-Cpp. i did manage to run it using wine but i still cannot run exe's produced by Dev-Cpp. i think they can also be run using wine but here comes another problem - im using live session :D
i know i should install the system like normal man but that is not question, i need to know how can i make Code::Blocks compile that thing above
Alibeg
Junior Poster in Training
81 posts since Aug 2008
Reputation Points: 11
Solved Threads: 11
ive learnt c in wrong way...using compilers that compile everything makes you forget standard ways
Alibeg
Junior Poster in Training
81 posts since Aug 2008
Reputation Points: 11
Solved Threads: 11
yeah i konw that :D thanks
Alibeg
Junior Poster in Training
81 posts since Aug 2008
Reputation Points: 11
Solved Threads: 11
#include <iostream.h>
int main ()
{
std::cout << "Welcome to C++ programming!\n";
return 0;
}
wont compile on Code::Block on ubuntu Intrepid Ibex
says:
3: Syntax error: "(" unexpected
Press ENTER to coutinue.
i've just installed it so maybe it needs some configuring, but i heard that it already uses GCC compiler and has everything it needs to work well http://www.codeblocks.org/features
Alibeg
Junior Poster in Training
81 posts since Aug 2008
Reputation Points: 11
Solved Threads: 11
ArkM
Postaholic
2,001 posts since Jul 2008
Reputation Points: 1,234
Solved Threads: 348
Oh yes but have a look at this main body ;)
Well, "Problem is that Code::blocks wont compile this". What happens? Where are compiler diagnostics?
ArkM
Postaholic
2,001 posts since Jul 2008
Reputation Points: 1,234
Solved Threads: 348
i know this should have been C++ but when i started i didnt have a clue whether it was c or c++ compiler (I could have posted a new thread but it seemed aggressive)
Diagnostics:
3: Syntax error: "(" unexpected
Press ENTER to coutinue.
i tried both iostream and iostream.h,and i did try printf also. nothing works. maybe an Intrepid Ibex that is making problems, but i still think im missing something in configuration
Alibeg
Junior Poster in Training
81 posts since Aug 2008
Reputation Points: 11
Solved Threads: 11
hahahaha! you're the man...yes i did save it as Prog, but i forgot that Code::Blocks wont add extension by itself so it treated my source code as a text file or i dont know what (my only excuse is that it did write clearly: c/c++ file for file type). i added .cpp myself (and one version with .c)
now im facing problem when compiling, i use iostream, iostream.h but compiler cannot find them. when i use stdio.h and printf instead it says:
Compiling: /media/ALIJA/Alija/Prog.c
Linking console executable: /media/ALIJA/Alija/Prog
/bin/sh: g++: not found
Process terminated with status 127 (0 minutes, 0 seconds)
0 errors, 0 warnings
i thought i had the compiler (GNU GCC, it found it on startup and it set it up to be default one).
am i missing compiler? or i didnt set it?
Alibeg
Junior Poster in Training
81 posts since Aug 2008
Reputation Points: 11
Solved Threads: 11