Code::Blocks - No default include directory.


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
#include <iostream>
#include <cstdlib>

using namespaces std;

int main()
{

cout << "Press any key and a message will appear saying 'Hello World'\n";

system("pause>nul");

cout << "HELLO WORLD \n";

system("pause>nul");
}


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.
Thanks
Could be an error occurred while installing. Try re-installing, and make sure you install code::blocks WITH minGW
I recommend downloading latest mingw witch comes with stl library (i think) and setup paths in IDE options
http://code.google.com/p/mingw-builds/downloads/list
I've downloaded and installed the mingw version with no luck. Have done this several times now.

Is there any way to install the stl or somehow link it in Code::Blocks. This is a real mystery.. Has Code::blocks worked for anyone else?
I also have DevC++ installed on this PC. Would that be affecting anything?
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:

http://www.dodaj.rs/?J/dx/3D3BWKPo/maincpp-delegates-codebl.jpg

Make sure youve choosen the right exe names!
I also have DevC++ installed on this PC. Would that be affecting anything?
I have in the past had problems when two different versions of MinGW were installed at the same time. By "problems" I mean perfectly valid code refusing to build with absurd error messages.
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.

http://www.cprogramming.com/code_blocks/

Thanks again for the help.
Dominover
Topic archived. No new replies allowed.