Computer Science Canada VS2008: Error C2679 help? |
Author: | deltatux [ Tue Feb 03, 2009 12:50 am ] | ||||
Post subject: | VS2008: Error C2679 help? | ||||
Hey guys, I'm trying to open a file, however, I'm running into problems: TDirectory.cpp
TDirectory.h
Error: Quote: error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'overloaded-function' (or there is no acceptable conversion) If I can't get this fixed, I might be forced to mix C with C++ and it'll go ugly... Many thanks, deltatux |
Author: | DemonWasp [ Tue Feb 03, 2009 9:17 am ] | ||
Post subject: | RE:VS2008: Error C2679 help? | ||
Your input statement:
is trying to read strings into your getter functions. That's probably not what you meant. |
Author: | md [ Tue Feb 03, 2009 12:07 pm ] |
Post subject: | RE:VS2008: Error C2679 help? |
Furthermore, character strings are a C construct. When using C++ you should use std::string wherever possible. |
Author: | deltatux [ Tue Feb 03, 2009 1:48 pm ] |
Post subject: | RE:VS2008: Error C2679 help? |
So should I just read them directly into chars in the struct? it worked on my other software but am having a tough time with this one =s... deltatux |
Author: | DemonWasp [ Tue Feb 03, 2009 1:50 pm ] |
Post subject: | RE:VS2008: Error C2679 help? |
No, just use the >> operator and change the types of your string variables to be std::string . |
Author: | deltatux [ Tue Feb 03, 2009 4:04 pm ] |
Post subject: | RE:VS2008: Error C2679 help? |
How do I do that? deltatux |
Author: | wtd [ Tue Feb 03, 2009 4:55 pm ] |
Post subject: | RE:VS2008: Error C2679 help? |
While you're at it, mixing C file handling and C++ iostreams is a good way to give yourself a headache. |
Author: | wtd [ Tue Feb 03, 2009 5:11 pm ] | ||
Post subject: | RE:VS2008: Error C2679 help? | ||
Think about what the error is telling you:
For the binary operator >> it's getting a right-hand operator of type overloaded-function. What does this mean? |
Author: | deltatux [ Tue Feb 03, 2009 5:27 pm ] |
Post subject: | Re: RE:VS2008: Error C2679 help? |
wtd @ Tue Feb 03, 2009 4:55 pm wrote: While you're at it, mixing C file handling and C++ iostreams is a good way to give yourself a headache.
Unfortunately, at my college, they came up with this brilliant idea by mixing C with C++ since we did C last semester, so they thought that by mixing C in C++ it'll make the transition easier =S... I think they shouldn't have done that. It's very confusing. and I don't understand the error at all >.<" deltatux |