[英]error LNK2019: unresolved external symbol classes
I get the error below when i call new TerrainClass() from the main, tried for hours to fix it, help please. 当我从主调用新的TerrainClass()时,遇到以下错误,尝试了几个小时进行修复,请提供帮助。
error LNK2019: unresolved external symbol "public: __thiscall TerrainClass::TerrainClass(void)" (??0TerrainClass@@QAE@XZ) referenced in function "void __cdecl init(void)" (?init@@YAXXZ)
GLDrawObject.h GLDrawObject.h
#pragma once
class GLDrawObject
{
};
Terrain.cpp Terrain.cpp
#pragma once
TerrainClass::TerrainClass() : GLDrawObject()
{
}
Terrain.h 地形
#pragma once
#include "GLDrawObject.h"
class TerrainClass : public GLDrawObject
{
public:
TerrainClass();
};
Firstly, your Terrain.cpp should be as follows: 首先,您的Terrain.cpp应该如下所示:
#include "Terrain.h"
TerrainClass::TerrainClass() : GLDrawObject()
{
}
Secondly, you are getting a linker error, not a compiler error; 其次,您得到的是链接器错误,而不是编译器错误。 once compiled, you need to link Terrain.o with the rest of your object files. 编译后,您需要将Terrain.o与其余目标文件链接。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.