Author Topic: #include <iostream> NO such File or Directory  (Read 295863 times)

Offline jayushkin

  • Single posting newcomer
  • *
  • Posts: 2
Re: #include <iostream> NO such File or Directory
« Reply #45 on: September 22, 2010, 11:51:19 am »
I don't understand why CodeBlocks should not set its own search paths properly when it gets installed.  Hopefully the remaining problem will yield to the same approach, otherwise I'm out of ideas.

Code::Blocks is an IDE, not a compiler, so it don't need to set searchpaths.
Normally the compiler finds his libs and headers without explicitely setting a searchpath.
If not, something is wrong with either your setup and/or yur compiler !
I downloaded Code::Blocks from the BerliOS site and installed it from the binary set-up file.  There were no configuration questions in the install.  I am running Vista, but I have also tried it on XP and gotten the same results (I will double-check this later).

Now there are searchpaths that can be set in the IDE (there are several windows for inputting them) -- who uses these?  The compiler or the IDE?  Somebody else?

I am assuming that I got the compiler along with the BerliOS download -- I did not download it separately.  Am I supposed to find and install a compiler separately and configure it into the IDE in order for this to work?

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: #include <iostream> NO such File or Directory
« Reply #46 on: September 22, 2010, 12:16:46 pm »
The search-paths are normally used for additional libraries/sdk's.
On my windows-system(s) I never had problems with using MinGW standard-headers.
And I never have to add anything into the search-directories for a simple "Hello world"-program that does not use third-party libs/sdk's.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6672
    • My Best Post
Re: #include <iostream> NO such File or Directory
« Reply #47 on: September 22, 2010, 05:43:19 pm »
I am assuming that I got the compiler along with the BerliOS download -- I did not download it separately.  Am I supposed to find and install a compiler separately and configure it into the IDE in order for this to work?

If the download file has "mingw" in the name you got the Windows MinGW GCC with it.

Note: If you already had MinGW GCC installed, Code::Blocks may have use the prior version instead.

Note2: Some people claim that Code::Blocks does NOT always configure the Compiler ToolChain correctly. Link on Wiki about Compiler Toolchain http://wiki.codeblocks.org/index.php?title=Installing_a_supported_compiler#Compiler-neutral_setup_steps

Note3: If you have a version of MinGW in the location "x:\MinGW" for any drive X; example "C:\MinGW" then a second install of MinGW GCC will NOT work right.

Note4: You should never use the file extension ".c" when you want the file compiled as an "C++" file.

Note5: If you have Cygwin install, it should NOT be in the path for certain cases when using MinGW GCC. IIRC, the compiling of wxWidgets, using MinGW GCC is one of those cases.

Tim S.

« Last Edit: September 22, 2010, 05:46:08 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

heello123

  • Guest
Re: #include <iostream> NO such File or Directory
« Reply #48 on: April 03, 2011, 10:01:56 pm »
hi see i had the same problem i have gcc compiler and i have it in the right directory and compiler and i have compilerlogging on and when i go to make a new file i make it understand that ii want a c/C++ gile but for some reason it always gives me a .c file and the C++ can never be put unless i have to make a new project which contains the main.cpp fiel and if i create a new file that file won't run either and i'm using the newest code::blocks binary release and these are my run time errors:


E:\Paarth\C++ source files\Practicer\Untitled1.c|1|error: iostream: No such file or directory|
E:\Paarth\C++ source files\Practicer\Untitled1.c|2|error: cmath: No such file or directory|
E:\Paarth\C++ source files\Practicer\Untitled1.c|3|warning: parameter names (without types) in function declaration|
E:\Paarth\C++ source files\Practicer\Untitled1.c|4|error: expected identifier or '(' before '{' token|
E:\Paarth\C++ source files\Practicer\Untitled1.c||In function 'main':|
E:\Paarth\C++ source files\Practicer\Untitled1.c|13|error: 'using' undeclared (first use in this function)|
E:\Paarth\C++ source files\Practicer\Untitled1.c|13|error: (Each undeclared identifier is reported only once|
E:\Paarth\C++ source files\Practicer\Untitled1.c|13|error: for each function it appears in.)|
E:\Paarth\C++ source files\Practicer\Untitled1.c|13|error: expected ';' before 'namespace'|
E:\Paarth\C++ source files\Practicer\Untitled1.c|14|error: 'cout' undeclared (first use in this function)|
E:\Paarth\C++ source files\Practicer\Untitled1.c|14|error: 'endl' undeclared (first use in this function)|
E:\Paarth\C++ source files\Practicer\Untitled1.c|16|error: 'cin' undeclared (first use in this function)|
E:\Paarth\C++ source files\Practicer\Untitled1.c|19|error: 'check' undeclared (first use in this function)|
||=== Build finished: 11 errors, 1 warnings ===|

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: #include <iostream> NO such File or Directory
« Reply #49 on: April 03, 2011, 10:34:42 pm »
You have to type the correct file-ending (.cpp n your case) if you save the file, default file-ending is .c at the moment.

Offline hundred4ever

  • Single posting newcomer
  • *
  • Posts: 3
Re: #include <iostream> NO such File or Directory
« Reply #50 on: April 14, 2016, 01:05:40 pm »
I set the directory to the standalone MinGW's location, in my case C:/MinGW

However, I find that the problem is equally solved by setting it to the MinGW directory found in CodeBLocks own installation folder, and that's perhaps the preferred solution.

In my case, it would be C:\Program Files\CodeBlocks\MinGW  . Once this directory is set, the header files are located without problems.
Settings > Compiler > Toolchain Executables > Compiler's Installation Directory


Your solution worked for me. Thanks. :)

In my case I was using 16.01mingwsetup.exe, and my compiler was set to C:\MinGW and wasn't working.

Changing the compiler's installation directory to link to CodeBlocks' MinGW worked for me.
I changed it to -- C:\Program Files (x86)\CodeBlocks\MinGW