这个编译错误是什么
What is this compilation error?
在尝试编译时,我收到以下错误:
1> main.obj:错误LNK2019:Verweis auf nicht aufgelöstes externes符号"public:void __thiscall Area::createArea(void)"(?createArea@Area@@QAEXXZ)"在函数"_main".1>D:\C++Projekte\EREBOS_2\Debug\EREBOS_2.exe:致命错误LNK1120:1 nicht外部Verweise。
英文翻译:
1> main.obj:错误LNK2019:对符号"的未解析外部引用public:void __thiscall区域::创建区域(void)"(?创建区域Area@@@QAEXXZ)"函数在"_main"1>D:.\C++Projects\EREBOS_2\Debug\EREBOS_2.exe:致命错误LNK1120:1个未解析的外部。
这是什么意思?我该怎么修?
代码:
#include <iostream>
#include "windows.h"
#include "MainMenu.h"
#include "MainPlayer.h"
#include <ctime>
#include <string>
int y;
int x;
using namespace std;
void createArea()
{
int area[15][15];
for(int y = 0; y < 15; y++)
{
for (int x = 0; x < 15; y++)
{
area[x][y] = 0;
}
}
//---------------------------------
for(int counter = 0; counter < 15; counter++)
{
area[1][y] = 1;
area[15][y] = 1;
}
//--------------------------------------
for (int y = 0; y <15; y++)
{
for (int x = 0; x < 15; x++)
{
cout << area[x][y];
}
}
}
#include <iostream>
#include "windows.h"
#include "MainMenu.h"
#include <ctime>
#include <string>
using namespace std;
void MainMenu:: createMenu()
{
int typed;
system("cls");
cout << endl;
cout << endl;
cout << " --------------" << endl;
cout << " | 1) Start |" << endl;
cout << " | 2) Hilfe |" << endl;
cout << " | 3) Credits |" << endl;
cout << " | 4) Beenden |" << endl;
cout << " --------------" << endl;
cin >> typed;
if(typed == 1)
{
cout << "...still a whole lot of work to do..." << endl;
}
}
#include <string>
class MainMenu
{
public:
void createMenu();
};
#include <iostream>
#include "windows.h"
#include "MainMenu.h"
#include "MainPlayer.h"
#include <ctime>
#include <string>
using namespace std;
void Mainplayer:: showData()
{
using namespace std;
int health = 100;
int xp = 0;
int lvl = 1;
int gold = 10;
std:: string Name = "Namenloser";
system("cls");
cout << "-----------------------" << endl;
cout << "Name: " << Name << endl;
cout << "Leben: " << health << "/100" << endl;
cout << "Erfahrung: " << xp << "/" << lvl*10 << endl;
cout << "Level: " << lvl << "/50" << endl;
cout << "Gold: " << gold << endl;
cout << "------------------------" << endl;
}
#include <string>
class Mainplayer
{
public:
int health;
int xp;
int lvl;
int gold;
std:: string Name;
void showData();
int playercoordy;
int playercoordx;
};
#include <iostream>
#include "windows.h"
#include "MainMenu.h"
#include "MainPlayer.h"
#include "Area.h"
#include <ctime>
#include <string>
using namespace std;
void maingame();
int main()
{
system("title EREBOS 2");
Mainplayer MainChar;
MainMenu menu;
Area MainArea;
menu.createMenu();
MainChar.showData();
MainArea.createArea();
getchar();
getchar();
}
该消息意味着您尝试调用"public:void __thiscall-Area::createArea(void)",但链接器找不到该函数。
我看到的最接近的是MainArea.createArea();-我猜,要么你还没有实现这个功能(在Area.pp中,你没有向我们展示),要么你只是没有链接Area.o,要么没有按照所需的顺序。
请参阅什么是未定义的引用/未解决的外部符号错误,以及如何修复它?
相关文章:
- 是什么导致了Unity 3D中的"错误线程异常"?
- 在C++中样板"冷/never_inline"错误处理技术的最佳方法是什么?
- 在C++中创建队列 - 什么是 malloc 错误?
- 当我从下面的代码中删除关键字 virtual 时,它可以正常工作,否则会出现错误。在这里"virtual"字的意义是什么?
- 没有可行的过载'='错误,可能导致这种情况的原因是什么?
- Clang 8 带有静态 constexpr 和数组的链接器错误 - 错误是什么以及如何解决它?
- 我遇到了黑客排名中的问题"TWO STRINGS"的三个测试用例的分段错误。原因是什么?
- 导致hash_map错误的原因是什么,如何修复它?
- 当我选择大于 720 的矩阵大小时,程序退出并显示错误代码.可能是什么原因?
- C++中的"expected unqualified-id"错误是什么?
- 谁能告诉我,程序中的错误是什么?该程序仅用于获取文件扩展名
- 是什么导致 glTexSubImage1D() - 加载纹理时在此示例中出现GL_INVALID_VALUE错误?
- 我的代码中针对 NQueens 问题的错误是什么?
- 这在C++是什么类型的错误?
- 出现这种错误的原因是什么"invalid use of non-static data member "
- 这种错误的原因是什么:将"功能"重新定义为不同类型的符号
- CUDA返回值错误35的含义是什么
- 这个错误可能是什么?ANSI C文件
- 是什么导致macOS Mojave上的GoogleTest链接错误
- 这个代码中的错误是什么,每次都会给我分段错误