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.next.codeblocks.org/index.php?topic=12666.msg%25msg_id%25
Quote from: deepak643 on March 08, 2014, 04:21:17 AM
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*.
Quote from: SuperBoi45 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*.
Correction <cstdio> is ALSO a C++ header, stdio.h is a C header.
Tim S.
Quote from: SuperBoi45 on April 05, 2014, 11:48:54 PM
For C projects you have to use <cstdio> and FILE*.
I think he meant C projects to be compiled with a C++ compiler.
Quote from: scarphin on April 06, 2014, 04:49:07 AM
Quote from: SuperBoi45 on April 05, 2014, 11:48:54 PM
For C projects you have to use <cstdio> and FILE*.
I think he meant C projects to be compiled with a C++ compiler.
Quote from: deepak643 on March 08, 2014, 04:21:17 AM
I am using GCC (not g++).
Its a C program (.c).
That means he has to use the "real" c-headers.