Code::Blocks Forums
User forums => Help => Topic started by: deepak643 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
-
gcc or g++? .c or .cpp? Have you read the FAQ on the wiki.codeblocks.org?
-
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
-
Its a C program (.c).
Then why are you trying to use a c++ header? This is never going to work.
-
<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*.
-
<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.
-
For C projects you have to use <cstdio> and FILE*.
I think he meant C projects to be compiled with a C++ compiler.
-
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.