dimanche 3 juillet 2016

Unresolved external symbol in a class function [duplicate]


can anyone tell me what is the problem with the following code:

#include <iostream>
#include <string>
using namespace std;

class Exception
{
    string err;
public:
    Exception (string _err) : err(_err) {}
    const string& Err ();
};

int main()
{
    Exception exc("error");
    cout << exc.Err() << endl;
}

I get unresolved external symbol error on call to the function Exception::Err.

EDIT: Now I see what's the problem, I'm sorry for asking such a stupid question. But I really did spent half an hour looking at the code trying to figure out what's wrong. Might aswell delete the question to save me from bad reputation. :D And you guys from a bad read. ;)


Aucun commentaire:

Enregistrer un commentaire