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

ive learnt c in wrong way...using compilers that compile everything makes you forget standard ways

#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

ArkM this is the C forum....really should be using printf() so yer lol, but still i thought it was iostream.h in C?

then again I think im just going crazy xD

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?

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

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?

Strange that it's looking for g++ when the filename has .c extension. Probably when you did "create new CB project" you specified c++ so there's something in the .cbp file telling it to use the c++ compiler.

Also, if you never actually installed gcc you probably don't have it. Ubuntu doesn't include it by default. You have to do "apt-get install build-essentials" or "apt-get install gcc" etc. It's easy enough to determine though. Just open a terminal window and type gcc [Enter]. Either it will tell you "gcc: command not found" or gcc: no input files" and then you will know. If "command not found", install a compiler. If "no input files", then the CB project is probably malformed. There's probably nothing wrong with your codeblocks installation. Just close the project, trash that project directory & start a new one.

open the terminal and type:
sudo apt-get install g++
this should install the package you need, well it worked for me anyway.

This article has been dead for over six months. Start a new discussion instead.