Re: Error C2679
- From: Mark <Mark@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 5 Nov 2008 11:12:07 -0800
Hi Ulrich,
Before I posted the question I did a bit of searching on the internet and I
came across a post saying that the <string> library wasn't included. I
included it in my project and get 5 errors instead of 3.
Errors with <string> included:
Error 1 error LNK2028: unresolved token (0A000355) "int __cdecl
CalculateBelowAverage(int const * const,float)"
(?CalculateBelowAverage@@$$FYAHQBHM@Z) referenced in function "int __cdecl
main(void)" (?main@@$$HYAHXZ) Arrays_p625.obj
Error 2 error LNK2028: unresolved token (0A000356) "int __cdecl
CalculateAboveAverage(int const * const,float)"
(?CalculateAboveAverage@@$$FYAHQBHM@Z) referenced in function "int __cdecl
main(void)" (?main@@$$HYAHXZ) Arrays_p625.obj
Error 3 error LNK2019: unresolved external symbol "int __cdecl
CalculateBelowAverage(int const * const,float)"
(?CalculateBelowAverage@@$$FYAHQBHM@Z) referenced in function "int __cdecl
main(void)" (?main@@$$HYAHXZ) Arrays_p625.obj
Error 4 error LNK2019: unresolved external symbol "int __cdecl
CalculateAboveAverage(int const * const,float)"
(?CalculateAboveAverage@@$$FYAHQBHM@Z) referenced in function "int __cdecl
main(void)" (?main@@$$HYAHXZ) Arrays_p625.obj
Error 5 fatal error LNK1120: 4 unresolved externals C:\Documents and
Settings\Mark McCumber\My Documents\Visual Studio 2005\Projects\Visual
C++\Arrays_p625\Debug\Arrays_p625.exe 1
If the first three errors are caused by <string> not being included, Why do
I get unresolved tokens and externals when the library is included? It
doesn't make logical sense from my purspective.
--
Mark
"Ulrich Eckhardt" wrote:
Mark wrote:.
#include "stdafx.h"[...]
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
string inFileName;[..]
cin >> inFileName;
Error 1 error C2679: binary '>>' : no operator found which takes a
right-hand operand of type 'std::string' (or there is no acceptable
conversion)
This program come right out of my textbook, so it should work.
No.
The error acts like the <iostream> wasn’t included.
Nope, it acts as if <string> wasn't included. The operator>> overload for a
std::string is in <string> and not <iostream>. Actually, the standard only
requires that <iostream> declares the classes istream, ostream and the
objects cin, cout, cerr, clog plus their wide counterparts. It doesn't
actually require that it fully defines the class, a simple forward
declaration is enough, so you theoretically <iostream> and <ostream> in
order to write to std::cout. In this case, <ostream> is implicitly included
by <fstream> though.
BTW: two more advanced lessons for you:
1. Read in the filename "C:\Documents and Settings\yourname\foo.barre".
2. Read in a number and then read that many filenames.
Uli
--
C++ FAQ: http://parashift.com/c++-faq-lite
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
- Follow-Ups:
- Re: Error C2679
- From: Igor Tandetnik
- Re: Error C2679
- References:
- Error C2679
- From: Mark
- Re: Error C2679
- From: Ulrich Eckhardt
- Error C2679
- Prev by Date: Re: Strange lowercase to uppercase conversion.
- Next by Date: Re: Error C2679
- Previous by thread: Re: Error C2679
- Next by thread: Re: Error C2679
- Index(es):
Relevant Pages
|