I've just installed code::blocks and have tried to create a simple console program as per below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
using namespaces std;
cout << "Press any key and a message will appear saying 'Hello World'\n";
cout << "HELLO WORLD \n";
I'm getting an error for every line of the code. For example, error: iostream, no such file or directory.
Now you would think that a default directory would be set up for Code::Blocks in the installation process but it seems that it hasn't. There's dozens of complains like this on the web but none of them seem to tell me how to install a default directory. Code::Blocks should be able to identify a iostream include file but it seems that it can't .
Is there something wrong with Build 10.05? Can anyone explain how to fix this.
What path options did you changed after you extracted mingw package?
I am using CB 10.05 with mingw 4.7!
Go to menu Settings / Compiler & debugger settings and then (under Global compiler settings) Search directories below compiler tab and set new include path folder witch come with mingw, and also do the same for linker (lib folder within mingw). And then go to Toolchain executable tab above and set compiler executables, see my picture:
Thanks for coming back all.. I've got it working now. It seems I've been a bit spoiled with DevC++ where everything is already set up for you when you start.
It seems Code::Blocks is different in the sense that you have to start a new project and specify which language you want to program in. As long as you keep programming under that same project (folder) then you don't need to set up again.
I've simply gone in through File>New>Console Programming> and started a new program that way, then everything is set up. I'm assuming that if that project/folder gets deleted then I have to do this again.
What I did initially was select File>New>File and started programming. Obviously that didn't work.
That was very painful.. I almost went back to using Dev.
Some instructions from the web below. I'm sure I'm not the first to have this issue.