0

This is in a Windows Console application, so I have no idea how this is happening at all.

#include "Library.h"

//poglathon.cpp
//starting region


bool Poglathon(std::vector<std::string>& text,Player *player){
    using namespace std;
    cout << "You see a town to one side and a path leading to a dark, murky forest in the other side." << endl;
    int chosen = player->giveOptions(2,"Town","Path","","","");
    return true;
}
5
  • Further to Let_Me_Be's question: Pig Head, please show us the exact linker error message. Commented Mar 21, 2011 at 18:58
  • (keep clicking comment-up accidentally) bool __cdecl - is that the symbol? Commented Mar 21, 2011 at 18:58
  • Here's the entire message: error LNK2019: unresolved external symbol "bool __cdecl Poglathon(class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > &,class Player)" (?Poglathon@@YA_NAAV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@VPlayer@@@Z) referenced in function _main Commented Mar 21, 2011 at 18:59
  • Poglathon is the symbol. Please provide the definition, the declaration and the call statement of Poglathon. Commented Mar 21, 2011 at 19:03
  • Poglathon(vec, 0); // bang, you're dead Check for null (a valid pointer value!) or use a reference. Commented Mar 21, 2011 at 19:10

2 Answers 2

3

Your declaration in the header file looks like this:

bool Poglathon(std::vector<std::string>& text,Player player);

Your attempt to define in the cpp file looks like this:

bool Poglathon(std::vector<std::string>& text,Player * player);

Change the declaration to take a Player * instead of a Player

Sign up to request clarification or add additional context in comments.

Comments

2

Apparently the problem is that the declaration of the function (inside your header files) is like this:

bool Poglathon(std::vector<std::string>& text,Player player);

But you defined it like this:

bool Poglathon(std::vector<std::string>& text,Player *player)

Decide what you want and be consistent.

1 Comment

Whoops, I forgot about that declaration.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.