Author Topic: fstream: No such file or directory  (Read 44749 times)

Offline deepak643

  • Single posting newcomer
  • *
  • Posts: 2
fstream: No such file or directory
« on: March 08, 2014, 01:23:35 am »
When I include fstream, my program throws

fatal error: fstream: No such file or directory.

How to resolve this? It seems to be wierd.. I am using gcc compiler.

Please suggest

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: fstream: No such file or directory
« Reply #1 on: March 08, 2014, 01:46:48 am »
gcc or g++? .c or .cpp? Have you read the FAQ on the wiki.codeblocks.org?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline deepak643

  • Single posting newcomer
  • *
  • Posts: 2
Re: fstream: No such file or directory
« Reply #2 on: March 08, 2014, 04:21:17 am »
I am using GCC (not g++).
Its a C program (.c).

I checked the FAQ in this forum.. the below is the thread I have found.. but i didn't find it useful.

http://forums.codeblocks.org/index.php?topic=12666.msg%25msg_id%25


Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: fstream: No such file or directory
« Reply #3 on: March 08, 2014, 08:58:10 am »
Its a C program (.c).
Then why are you trying to use a c++ header? This is never going to work.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline SuperBoi45

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: fstream: No such file or directory
« Reply #4 on: April 05, 2014, 11:48:54 pm »
<fstream> is a C++ file. Are you trying to use the standard C++ file stram std::fstream? If so, then make a C++ project. For C projects you have to use <cstdio> and FILE*.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7590
    • My Best Post
Re: fstream: No such file or directory
« Reply #5 on: April 06, 2014, 02:45:02 am »
<fstream> is a C++ file. Are you trying to use the standard C++ file stram std::fstream? If so, then make a C++ project. For C projects you have to use <cstdio> and FILE*.

Correction <cstdio> is ALSO a C++ header, stdio.h is a C header.

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 scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: fstream: No such file or directory
« Reply #6 on: April 06, 2014, 04:49:07 am »
For C projects you have to use <cstdio> and FILE*.
I think he meant C projects to be compiled with a C++ compiler.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: fstream: No such file or directory
« Reply #7 on: April 06, 2014, 09:53:23 am »
For C projects you have to use <cstdio> and FILE*.
I think he meant C projects to be compiled with a C++ compiler.
I am using GCC (not g++).
Its a C program (.c).
That means he has to use the "real" c-headers.