1>Main.obj : error LNK2019: unresolved external symbol "public: __thiscall BullsAndCows::BullsAndCows(void)" (??0BullsAndCows@@QAE@XZ) referenced in function _main
That's a link error. It's telling you that when you're linking your objects to create the executable, there's no definition for BullsAndCows::BullsAndCows(void).
Just as a kindly remark: Please don't use exclamation marks (!) after every sentence. In many cultures this is perceived as shouting and thus rude. I'm not saying you are intending to be rude, I'm just saying it's something you should probably be aware of.
As to your issue - what do you mean by:
I set No to linking !!!
The problem can be easily fixed as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#pragma once
#include <String>
usingnamespace std;
class BullsAndCows
{
private:
int fSecretNumbers[9];
int fSecretNumberIndex;
public:
BullsAndCows() =default; //we accept the default constructor implementation of the compilervoid start ();
bool guess( string aNumberString );
};
As a small remark: note that #pragma once is not supported by all pre-processors. Thecross-platform way of doing this is to use include guards:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#ifndef BULLS_AND_COWSH //if this was not defined already
#define BULLS_AND_COWSH //define it, so the check above will fail next time
#include <String>
usingnamespace std;
class BullsAndCows
{
private:
int fSecretNumbers[9];
int fSecretNumberIndex;
public:
BullsAndCows() =default;
void start ();
bool guess( string aNumberString );
};
#endif //close ifndef