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

shiguy48

  • Guest
#include <iostream> NO such File or Directory
« on: November 02, 2007, 03:19:03 pm »
hello there i am new to c++

i have tryed to compile this program but it says


#include <iostream> NO such File or Directory

was just wondering y as some of my programs work right but some do this

#include <iostream>
using namespace std

main()
{
    cout << "hello there Does this program work"  << endl;
    cout << "check it a new line"  << endl;
    return(0);
}

any help would be apprecated greatly thx
« Last Edit: November 02, 2007, 03:21:38 pm by shiguy48 »

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: #include <iostream> NO such File or Directory
« Reply #1 on: November 02, 2007, 03:32:01 pm »
Sounds like your compiler is incorrectly installed; are you using MinGW/GCC?

(Note: Once this problem is fixed, you'll also need a semicolon ";" after using namespace std and an "int" before main(), to successfully compile.)
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5489
Re: #include <iostream> NO such File or Directory
« Reply #2 on: November 02, 2007, 04:01:31 pm »
just checked this with MinGW GCC4.2.1, works ok, with the side effect that the the file is found twice !!!
Once in : c:\MinGW\lib\gcc\mingw32\4.2.1-dw2\include\c++\iostream
and once in  C:\MinGW\lib\gcc\mingw32\4.2.1-dw2\include\c++\iostream

note the difference : c <---> C:

This is something we didn't have with MinGW GCC 3.4.5, or it should be a very recent regression; Can anyone check this with the latest svn on MinGW3.4.5 ? The earliest I can get hold of a MinGW GCC 3.4.5 system is on monday.

Offline gd_on

  • Lives here!
  • ****
  • Posts: 795
Re: #include <iostream> NO such File or Directory
« Reply #3 on: November 02, 2007, 04:37:36 pm »
I tried this program with gcc 3.4.5 after corrections suggested by Tdragon. (C::B 4564, windows XP, SP2)
Activating all warning and strict iso checking... full message display...
But all is working well, no problem at compilation or link time. No double definition. But may be I forgot to activate something !

gd_on
« Last Edit: November 02, 2007, 04:39:27 pm by gd_on »
Windows 11 64 bits (23H2), svn C::B (last version or almost!), wxWidgets 3.2.4 (tests with 3.3), Msys2 Compilers 13.2.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5489
Re: #include <iostream> NO such File or Directory
« Reply #4 on: November 02, 2007, 04:44:47 pm »
forgot the power of remote desktop : on on GCC 3.4.5 system this is OK. So it seems that with GCC 4.2.1 we probably shouldn't add it's internal compiler list (cc plug-in), or something like that ....

shiguy48

  • Guest
Re: #include <iostream> NO such File or Directory
« Reply #5 on: November 02, 2007, 04:49:57 pm »
yes i am using ming could somebody tell step by step lol what to do im lost when it comes to all this

a wierd thing is it did for a few programs but doesnt work no so if someone can help me i will be
very apprective

thx
« Last Edit: November 03, 2007, 02:30:22 am by shiguy48 »

shiguy48

  • Guest
Re: #include <iostream> NO such File or Directory
« Reply #6 on: November 03, 2007, 07:05:23 pm »
i tryed reinstalling it but i didnt seem to work any more ideas peeps

any more help would be extremely helpful

Zantetsken

  • Guest
Re: #include <iostream> NO such File or Directory
« Reply #7 on: November 01, 2009, 07:16:12 am »
Sorry to bump an ancient topic, but it was at the top of the list on Google when I searched iostream codeblocks. I was having the same problem and hoped to find a solution, but there was none to be found. All your "MinGW" and "GCC" just confused the hell out of me since I'm completely new to C++ and have no idea what anything is.


The solution is to put your .c file in the same folder you have Code::Blocks installed in. I originally had test.c on my desktop and got the same error shiguy48 did, but it worked perfectly fine when I moved it to C:\Program Files\CodeBlocks and tried it from there.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7576
    • My Best Post
Re: #include <iostream> NO such File or Directory
« Reply #8 on: November 01, 2009, 05:46:59 pm »
Sorry to bump an ancient topic, but it was at the top of the list on Google when I searched iostream codeblocks. I was having the same problem and hoped to find a solution, but there was none to be found. All your "MinGW" and "GCC" just confused the hell out of me since I'm completely new to C++ and have no idea what anything is.


The solution is to put your .c file in the same folder you have Code::Blocks installed in. I originally had test.c on my desktop and got the same error shiguy48 did, but it worked perfectly fine when I moved it to C:\Program Files\CodeBlocks and tried it from there.

FYI:

C++ files are required to have the extension .cpp when using Code::Blocks.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: #include <iostream> NO such File or Directory
« Reply #9 on: November 03, 2009, 03:50:47 pm »
All your "MinGW" and "GCC" just confused the hell out of me since I'm completely new to C++ and have no idea what anything is.
A word of advice, then -- RTFM. Read everything, in fact, because right on the Code::Blocks download page it says:

Quote
NOTE: The codeblocks-8.02mingw-setup.exe file includes the GCC compiler and GDB debugger from MinGW.

That makes it fairly clear.
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Offline Cplusser1

  • Single posting newcomer
  • *
  • Posts: 3
Re: #include <iostream> NO such File or Directory
« Reply #10 on: January 06, 2010, 12:04:10 am »
I am having the same issue but I downloaded from the codeblocks-8.02mingw-setup.exe and have double-checked all of my settings but cannot find any reason why iostream cannot be found. Any help?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7576
    • My Best Post
Re: #include <iostream> NO such File or Directory
« Reply #11 on: January 06, 2010, 03:24:45 am »
I am having the same issue but I downloaded from the codeblocks-8.02mingw-setup.exe and have double-checked all of my settings but cannot find any reason why iostream cannot be found. Any help?

Turn on full compiler logging
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Cplusser1

  • Single posting newcomer
  • *
  • Posts: 3
Re: #include <iostream> NO such File or Directory
« Reply #12 on: January 06, 2010, 07:20:55 pm »
I have tried that and it didn't work. :(

Offline Seronis

  • Almost regular
  • **
  • Posts: 197
Re: #include <iostream> NO such File or Directory
« Reply #13 on: January 08, 2010, 04:12:50 am »
I have tried that and it didn't work. :(

The 'work' part is when you take the time to copy the full log and paste it here so the experts can see what you did wrong.

bezerker999

  • Guest
Re: #include <iostream> NO such File or Directory
« Reply #14 on: January 09, 2010, 06:00:33 am »
I am having the same problem with "iostream" and I moved my "test.c" to C:/Program Files/codeblocks and it worked.
Two questions:
   1. Why?
   2. What do I have to do to compile *.c in other directories

Global Settings:
   GNU GCC Complier
   Toolchain ex
      instal dir = C:\Program Files\CodeBlocks\MinGW
      no make.exe in bin directory but found a mingw32-make.exe
         
Windows 2000 Pro
Dell Latitudue Laptop
===================================================================