Dev-C++ doesn't like fstream or string O.o

Started by
6 comments, last by Zahlman 18 years, 4 months ago
For some reason, Dev C++ isn't regonizing fstream or string at all. It figures i'm trying to declare variables called fstream and string, and not the other way around. I've been using Dev C++ for the fact that it can hdie the console window and run things in the background (having a black box up all the time jsut for a background changer is rather bothersome). Does anyone know why Dev C++ doesn't like strings and fstreams? Thanks in advance^^ Mreow.
Advertisement
You have included <fstream> and <string>, correct?
:stylin: "Make games, not war.""...if you're doing this to learn then just study a modern C++ compiler's implementation." -snk_kid
simple do this.

#include <fstream>#include <string>//you do this because I am not sure what features you want to useusing namespace std;int main(){//do whatever you want here using fstream or string such asstring stThisIsAString;ofstream fout;//ect...return 0;}
Gor435 - My Journal - MySpace - Facebook
As was pointed out by Gor435, you were probabally missing some form of:

using namespace std;
...
using std::string;
using std::ifstream;
using std::ofstream;
...
std::string str1;
std::ifstream IF;
std::ofstream OF;

That is unless you didn't do what stylin said [wink]
Hmm, 'twas using namespace std; Which is odd cuz i havn't had problems with not using it untill now, i've always jsut used <cstdlib> *shrugs* aww well works now, lol.

Meow.
Those items aren't present in <cstdlib>, and cstdlib "stuff" is not in the standard namespace, because it's imported from C and mostly intended for backwards compatibility (although it isn't actually deprecated like iostream.h etc.). You should be using the new stream libraries because they don't spit on C++'s enhanced type system, and you should be using std::string because... well, you *have* read my other posts yes? :)
im curious to see how your theory on strings pertains to chars of the unsigned variety =_=
|aaap.penopticon.com| My website, including game projects. Collaboration/comments are welcome, please visit :)
Quote:Original post by AAAP
im curious to see how your theory on strings pertains to chars of the unsigned variety =_=


The theory goes that beginners normally don't (or shouldn't have to try to) solve the kinds of problems where those sorts of things are appropriate. :)

This topic is closed to new replies.

Advertisement