Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

n0ob

VC++6.0, ambiguous symbol.. fstream.. meh

This topic is 5326 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m having this really stupid error all of a sudden. I''m working on this big project, with lots of cpps and headers. I have a couple cpps that use fstream just fine. So I''m makin a new cpp, and I try to create an ifstream object, but what do I get?? THis: error C2872: ''ifstream'' : ambiguous symbol. So I have been looking everywhere, can''t find anything wrong. This is the line: ifstream fin("pobjs.txt"); It is in a member function of a struct defined in the appropriate header file. So I was wondering, has anyone had this error before and knows what to do? I''m really hoping that it is something stupid that can be easily fixed.. and not some kind of horrible multiple-files-and-their-order etc.. Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Did you try to change it to use std::ifstream instead of plain ifstream? It sounds like something else called ifstream was declared in a visible namespace.

Share this post


Link to post
Share on other sites
error C2079: 'fin' uses undefined class 'basic_ifstream >'

There's not something weird with including fstream.h multiple times is there? The weird thing is that I commented all but one instance of #include <fstream.h> out, the only place the compiler said I needed it was in an .h file where a struct's member function took an ifstream& as a parameter. Bah.. thanks.. any more ideas?

[edited by - n0ob on January 15, 2004 12:24:35 PM]

Share this post


Link to post
Share on other sites
Well, I guess all the cpps are somehow linked to fstream.h through my unfortunate tangle of #includes.. so never mind what I said about that.. BUT, it works in some cpps and not others..

Share this post


Link to post
Share on other sites
Holy fek, I just did , but now ifstream is undeclared.. What is the replacement (So I don''t have to go read the file or msdn or whatever )

Share this post


Link to post
Share on other sites
When you #include <fstream>, ifstream is in the "std" namespace. Either explicitly declare std::ifstream or put a using namespace std; in your cpp files where you use ifstream.

Share this post


Link to post
Share on other sites
quote:
Original post by n0ob
error C2079: 'fin' uses undefined class 'basic_ifstream >'



I already tried that, remember? No workie :S Thanks

[edited by - n0ob on January 15, 2004 5:34:35 PM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!