VC++常规错误之一:error LNK2019: 无法解析的外部符号 "public: void __thiscall
2015-05-15 14:24
567 查看
error LNK2019: 无法解析的外部符号 “public: void __thiscall
遇到这种情况原因有二个,简单点说:
其一:某个方法只是在.h里面声明,没有在cpp里面实现。
其二:声明和实现都有了,但是没有添加到vs的虚拟工作目录下面,这时候如果在其他.cpp引用的话就抱这个错
比如我新建项目导入别人的代码的时候,忘记在上图显示的虚拟目录下添加CSContentJsonDictionary.h和CSContentJsonDictionary.cpp
他就会报错说:1>CCSReader.obj : error LNK2019: 无法解析的外部符号 “public: void __thiscall cs::CSJsonDictionary::initWithDescription(char const )” (?initWithDescription@CSJsonDictionary@cs@@QAEXPBD@Z),该符号在函数 “public: class CocoGUI::CocoWidget __thiscall CocoGUI::CCSReader::widgetFromJsonFile(char const *)” (?widgetFromJsonFile@CCSReader@CocoGUI@@QAEP***CocoWidget@2@PBD@Z) 中被引用
因为我在CocoGUI::CCSReader::widgetFromJsonFile(char const )的方法里面引用了cs::CSJsonDictionary::initWithDescription(char const )这个方法。解决办法就是在虚拟目录单击右键添加.h和.cpp.添加完之后重新生成以下就没问题了。具体的为什么这样,现在我的水平有限,等自学完《《编译原理》》,我想我会从逻辑推理上解释清楚的。。。期待。。。
遇到这种情况原因有二个,简单点说:
其一:某个方法只是在.h里面声明,没有在cpp里面实现。
其二:声明和实现都有了,但是没有添加到vs的虚拟工作目录下面,这时候如果在其他.cpp引用的话就抱这个错
比如我新建项目导入别人的代码的时候,忘记在上图显示的虚拟目录下添加CSContentJsonDictionary.h和CSContentJsonDictionary.cpp
他就会报错说:1>CCSReader.obj : error LNK2019: 无法解析的外部符号 “public: void __thiscall cs::CSJsonDictionary::initWithDescription(char const )” (?initWithDescription@CSJsonDictionary@cs@@QAEXPBD@Z),该符号在函数 “public: class CocoGUI::CocoWidget __thiscall CocoGUI::CCSReader::widgetFromJsonFile(char const *)” (?widgetFromJsonFile@CCSReader@CocoGUI@@QAEP***CocoWidget@2@PBD@Z) 中被引用
因为我在CocoGUI::CCSReader::widgetFromJsonFile(char const )的方法里面引用了cs::CSJsonDictionary::initWithDescription(char const )这个方法。解决办法就是在虚拟目录单击右键添加.h和.cpp.添加完之后重新生成以下就没问题了。具体的为什么这样,现在我的水平有限,等自学完《《编译原理》》,我想我会从逻辑推理上解释清楚的。。。期待。。。
相关文章推荐
- VC++常规错误之一:error LNK2019: 无法解析的外部符号 "public: void __thiscall
- VC++常规错误之一:error LNK2019: 无法解析的外部符号 "public: void __thiscall
- VC++常规错误之一:error LNK2019: 无法解析的外部符号 "public: void __thiscall
- VC编译错误:error LNK2019: 无法解析的外部符号 "void __stdcall _com_issue_error(long)" (?_com_issue_error@@YGXJ@Z),该符号在函数 "void __cdecl _com_ut
- 错误 4 error LNK2019: 无法解析的外部符号 "public: __thiscall CRobotProvider::~CRobotProvider(void)" (??1CRobotP
- 错误 1 error LNK2019: 无法解析的外部符号 "public: __thiscall chain<int>::~chain<int>(void)" (??1?$chain@H@@QAE@
- 错误 error LNK2019: 无法解析的外部符号 "void __cdecl ........的解决
- VC++常见错误原因解析--error LNK2019: 无法解析的外部符号 "public: void __thiscall
- error LNK2019: 无法解析的外部符号 "public: virtual void * __thiscall
- error LNK2019: 无法解析的外部符号 "public: __thiscall Date::~Date(void)" (??1Date@@QAE@XZ),该符号在函数 _main 中被引用
- main.obj:-1: error: LNK2019: 无法解析的外部符号 "public: __thiscall CFindFileForm::CFindFileForm(class QWidge
- VC++常见错误原因解析--error LNK2019: 无法解析的外部符号 "public: void __thiscall
- "error LNK2019: 无法解析的外部符号"错误的解决办法
- 处理--->错误 error LNK2019: 无法解析的外部符号"~~~~" | 该符号"~~~"在函数 _main 中被引用
- VC++常见错误原因解析--error LNK2019: 无法解析的外部符号 "public: void __thiscall
- VC++常见错误原因解析--error LNK2019: 无法解析的外部符号 "public: void __thiscall
- mainwindow.obj:-1: 错误:LNK2019: 无法解析的外部符号 "__declspec(dllimport) public:
- VC++常见错误原因解析--error LNK2019: 无法解析的外部符号 "public: void __thiscall
- VC++常见错误原因解析--error LNK2019: 无法解析的外部符号 "public: void __thiscall
- VC++常见错误原因解析--error LNK2019: 无法解析的外部符号 "public: void __thiscall