首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何获得链接器错误:未解析的外部符号

如何获得链接器错误:未解析的外部符号
EN

Stack Overflow用户
提问于 2011-03-22 02:55:15
回答 2查看 639关注 0票数 0

这是在Windows控制台应用程序中,所以我根本不知道这是如何发生的。

代码语言:javascript
复制
#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;
}
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-03-22 03:06:04

您在头文件中的声明如下所示:

代码语言:javascript
复制
bool Poglathon(std::vector<std::string>& text,Player player);

您尝试在cpp文件中定义的内容如下所示:

代码语言:javascript
复制
bool Poglathon(std::vector<std::string>& text,Player * player);

更改声明以接受Player *而不是Player

票数 3
EN

Stack Overflow用户

发布于 2011-03-22 03:06:10

显然,问题是函数的声明(在你的头文件中)是这样的:

代码语言:javascript
复制
bool Poglathon(std::vector<std::string>& text,Player player);

但你是这样定义的:

代码语言:javascript
复制
bool Poglathon(std::vector<std::string>& text,Player *player)

决定你想要什么,并且保持一致。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5382242

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档