Code::Blocks Forums

User forums => Help => Topic started by: chrysop on March 20, 2013, 11:31:45 am

Title: Cannot find path for include file
Post by: chrysop on March 20, 2013, 11:31:45 am
Hello!

I've just installed Code::Blocks in my PC running Windows 7 SP1 (Greek) but when I try to run a C++ program I get an error message saying "Fatal error: iostream no such file or directory".

It would seem that some base path for the include files wasn't set so I tried setting some paths in Settings -> Compiler -> Search Directories but it didn't help.

Any help would be greatly appreciated!

Title: Re: Cannot find path for include file
Post by: Jenna on March 20, 2013, 12:13:35 pm
This error can happen if you try to include a c++-header (like iostream) in a file that is compiled with a c-compiler.
Normally the searchpath for the compilers own system-headers and libs do not need to be set explicitely. Usually the compilers "know" where they are, if nobody has moved folders or files in the compilers installation directory.
Title: Re: Cannot find path for include file
Post by: chrysop on March 20, 2013, 02:11:54 pm
And what should I do in this case? I tried auto-detecting the compiler from Settings -> Compiler -> Toolchain executables and it seemed to find the correct compiler (the mingw32 compiler, although I don't recall now if it found the gcc or g++ one).

Anything else I should / could do?

It might help to say that when I was installing Code::Blocks I had to run the setup file as administrator, so maybe I have to run the executable as administrator as well? (I just thought of that...)
Title: Re: Cannot find path for include file
Post by: Jenna on March 20, 2013, 02:19:25 pm
What's the extension of your source-file ?
Title: Re: Cannot find path for include file
Post by: chrysop on March 20, 2013, 02:32:16 pm
Ok, I should have seen that... Code::Blocks added a default extention of ".c" to my file, even though the extention typed was named as "C/C++ source file".

Changing that to ".cc" solved all my problems...  ;D

Thanks a lot people!