所以我开始为我的c ++程序创建一个传递器而且我已经有一段时间出现这个错误了。在项目中包含.obj文件时出现了错误但是我刚刚将它删除了我还有这些错误。
我知道这只是我对象的传球者的开始,但它仍然不应该在.obj文件中出现错误,此时实际方法甚至不被调用
以下是错误:
error LNK1120: 1 unresolved externals \Debug\FP3DA Framework.exe FP3DA Framework
error LNK2019: unresolved external symbol "class GameObject __cdecl object(void)" (? object@@YA?AVGameObject@@XZ) referenced in function "public: class GameObject __thiscall passer::fileRead(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?fileRead@passer@@QAE?AVGameObject@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) passer.obj FP3DA Framework
以下是目前不完整的传球手代码:
#include "passer.h"
using namespace std;
GameObject passer::fileRead(std::string filename)
{
GameObject object();
string MaterialLib;
char fileChar;
// Open File
ifstream File;
File.open(filename.c_str());
//Check open correctly
if(!File.good())
cerr << "Can't open file" << endl;
//if open
if(File)
{
fileChar = File.get();
switch(fileChar){
case 'm': //Material 'mtllib'
fileChar = File.get();
while(fileChar != ' ')
fileChar = File.get();
fileChar = File.get();
break;
case '#':
fileChar = File.get(); // Next Character from #_
fileChar = File.get(); // Next Character from #__
if(File.get() != ' ')
{
//name of object
}
else
// File.getline; // Next Line
break;
case 'v':
fileChar = File.get();
//get vertices
break;
case 'vn':
fileChar = File.get();
//get vertex normal
break;
case 'vt':
fileChar = File.get();
//get vertex texture
break;
case 'f':
fileChar = File.get();
//get faces
break;
case ' ': //Skip line
// fileChar = File.getline;
break;
}
} //file closed
//READ MATERIAL FILE
return object();
}//end of file reader method
passer::passer(){}
passer::~passer(){}