我在 Visual C++ 6 上遇到了这个奇怪的链接器错误(我没有选择该工具)。我什至不知道从哪里开始看这个(我的 C++ 经验有限)。这些是错误:
CScripting.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall CScripting::~CScripting(void)" (??1CScripting@@UAE@XZ)
CPythonPg.obj : error LNK2001: unresolved external symbol "private: static struct _object * CPythonPg::pyPgEnv" (?pyPgEnv@CPythonPm@@0PAU_object@@A)
这是CPythonPg.h:
#ifndef _CPYTHONPG_H_
#define _CPYTHONPG_H_
#include <sstream>
#include <Python.h>
#include "pgt.h"
using namespace std;
class CPythonPg {
private:
static PyObject* pyPgEnv;
public:
CPythonPg();
~CPythonPg();
protected:
static PyObject* getPyPgEnv(PGTYPE* pgt1, PGTYPE* pgt2);
};
#endif
这是CSripting.h:(我没有创建这个类,除了将实例添加到我的类 CPythonPg 之外,我无法更改它)
#ifndef _CSCRIPTING_H_
#define _CSCRIPTING_H_
#include <string>
#include <vector>
#include <map>
#include <set>
#include <exception>
#include <sstream>
#include <fstream>
#include <locale>
#include <stdlib.h>
#include <direct.h>
#include <windows.h>
#include <io.h>
#include "pgt.h"
class CPythonPg; // added for python functionality
using namespace std;
class CScripting {
private:
string sMod;
string sCust;
string sProf;
string sScript;
CPythonPg* pyInst; // added for python functionality
typedef vector<pair<string, string> > cmdLines_t;
cmdLines_t vCmdLines;
bool bFoundPy; // added for python functionality
public:
typedef map<string, string> catalog_t;
typedef map<string, string> envVars_t;
CScripting(){};
CScripting(string _sMod, string _sCust, string _sProf, string _sScript, PGTYPE* Pgt1, PGTYPE* Pgt2);
virtual ~CScripting();
int findProcessingScripts();
void run(envVars_t& mEnvVars);
};
#endif
什么可能导致这种类型的错误?
编辑:修正了一些错别字。