Re: LNK2019: unresolved external symbol - What am I forgetting?
<lfinsto1@gwdg.de> wrote:
Please note that `using namespace std;' must be included
before
including the headers. At least, it had to be on my
installation.
Why, for goodness sake, you need that?
I don't know. I just tested it in a console application
and it wasn't
needed. Then I tried commenting it out in a dialog box
application,
which then failed to compile with this error:
error C2061: Syntaxfehler: Bezeichner 'ifstream'
I don't think it ought to be this way, and finding the
problem was very
aggravating. However, having gotten it to work, I haven't
gone into
the matter any further. I assume something in one or more
of the
header files refers to something in the `std' namespace
without the
qualifier. That doesn't explain why it's not needed in
the console
application, though.
I consider my "solution" to be a kludge, so if anyone has
a genuine
one, I'd be very happy to change my code.
It's definitely the kludge. All Standard C++ Library code is
inside `std' namespace and don't require any external
actions to be happy with itself. In order to use it, _you_
need to prepend standard names with `std::' prefix or
introduce `std' namespace in the translation unit with
`using' declaration.
I reckon that what happened is that some header is using
ifstream name and this header was included in .CPP file
before `using namespace std;' declaration (in this .CPP
file).