(cocos2dx vs2010)Tinyxml error LNK2019的解决方法

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/windvally/article/details/45740975

2>TinyXmlTest.obj : error LNK2019: 无法解析的外部符号 "public: class TiXmlElement const * __thiscall TiXmlNode::FirstChildElement(void)const " (?FirstChildElement@TiXmlNode@@QBEPBVTiXmlElement@@XZ),该符号在函数 "public: class TiXmlElement * __thiscall TiXmlNode::FirstChildElement(void)" (?FirstChildElement@TiXmlNode@@QAEPAVTiXmlElement@@XZ) 中被引用

2>TinyXmlTest.obj : error LNK2019: 无法解析的外部符号 "public: char const * __thiscall TiXmlElement::Attribute(char const *)const " (?Attribute@TiXmlElement@@QBEPBDPBD@Z),该符号在函数 "private: void __thiscall TinyXmlTest::loadXmlEle(class TiXmlElement *)" (?loadXmlEle@TinyXmlTest@@AAEXPAVTiXmlElement@@@Z) 中被引用

2>TinyXmlTest.obj : error LNK2019: 无法解析的外部符号 "public: char const * __thiscall TiXmlElement::GetText(void)const " (?GetText@TiXmlElement@@QBEPBDXZ),该符号在函数 "private: void __thiscall TinyXmlTest::loadXmlEle(class TiXmlElement *)" (?loadXmlEle@TinyXmlTest@@AAEXPAVTiXmlElement@@@Z) 中被引用

2>TinyXmlTest.obj : error LNK2019: 无法解析的外部符号 "public: __thiscall TiXmlDocument::TiXmlDocument(void)" (??0TiXmlDocument@@QAE@XZ),该符号在函数 "private: void __thiscall TinyXmlTest::loadXmlTest1(char const *)" (?loadXmlTest1@TinyXmlTest@@AAEXPBD@Z) 中被引用

2>E:\cocosproject\study_for_travel\proj.win32\Debug.win32\study_for_travel.exe : fatal error LNK1120: 4 个无法解析的外部命令

 

通过添加现有项导入:

tinystr.cpp

tinystr.h

tinyxml.cpp

tinyxml.h

tinyxmlerror.cpp

tinyxmlparser.cpp

 

导入后正常

展开阅读全文

vs2010 Link错误 error LNK2019

07-16

我按照http://blog.csdn.net/lqiujh/article/details/5772579所给的步骤生成了一些搜索工具Xapian的lib;创建了一个新的项目,想用一下他的api,把需要的lib都加进去了,编译成功,但是link会有如下错误rn//**********************************************************rn1>ManifestResourceCompile:rn1> All outputs are up-to-date.rn1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:libraryrn1>libcommon.lib(win32_uuid.obj) : error LNK2019: unresolved external symbol __imp__UuidFromStringA@8 referenced in function "int __cdecl uuid_parse(char const *,unsigned char * const)" (?uuid_parse@@YAHPBDQAE@Z)rn1>libcommon.lib(win32_uuid.obj) : error LNK2019: unresolved external symbol __imp__RpcStringFreeA@4 referenced in function "void __cdecl uuid_unparse_lower(unsigned char const * const,char *)" (?uuid_unparse_lower@@YAXQBEPAD@Z)rn1>libcommon.lib(win32_uuid.obj) : error LNK2019: unresolved external symbol __imp__UuidToStringA@8 referenced in function "void __cdecl uuid_unparse_lower(unsigned char const * const,char *)" (?uuid_unparse_lower@@YAXQBEPAD@Z)rn1>libcommon.lib(win32_uuid.obj) : error LNK2019: unresolved external symbol __imp__UuidCreate@4 referenced in function "void __cdecl uuid_generate(unsigned char * const)" (?uuid_generate@@YAXQAE@Z)rn1>D:\test\xapian_example\Debug\xapian_example.exe : fatal error LNK1120: 4 unresolved externalsrn1>rn1>Build FAILED.rn1>rn1>Time Elapsed 00:00:01.51rn========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========rn//**********************************************************rnrn但是我的头文件和lib都附加上了rn下边是我编的几句源码rn[code=C/C++][/code]#define _ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCHrn#include rn#include rnrnusing namespace std;rnrnint main(int argc, char **argv)rnrn // Simplest possible options parsing: we just require three or morern // parameters.rn if(argc < 4) rn cout << "usage: " << argv[0] < " << endl;rn exit(1);rn rnrn // Catch any Xapian::Error exceptions thrownrn rn Xapian::Document newdocument;rn Xapian::WritableDatabase database(argv[1], Xapian::DB_CREATE_OR_OPEN);rn Xapian::major_version();rnrn return 0;rnrnrn所以应该不是缺少lib的错误,从网上找了半天,真心找不到解决方案,请大牛指点啊 论坛

win7 64位 vs2010 error LNK2019

03-30

建立win32控制台空应用程序,使用模板实现单例模式。错误是说DelInstance、getInstance函数找不到实现。但实际上已经在Singleton.cpp中实现了。google未找到解决方法。在此求救,谢谢。rnrn错误如下:rnrn1>ClCompile:rn1> Singleton.cpprn1> _WIN32_WINNT not defined. Defaulting to _WIN32_WINNT_MAXVER (see WinSDKVer.h)rn1> Generating Code...rn1> Compiling...rn1> Test.cpprn1> _WIN32_WINNT not defined. Defaulting to _WIN32_WINNT_MAXVER (see WinSDKVer.h)rn1> Generating Code...rn1>ManifestResourceCompile:rn1> All outputs are up-to-date.rn[color=#FF0000]1>Test.obj : error LNK2019: unresolved external symbol "public: static void __cdecl Singleton::DelInstance(void)" (?DelInstance@?$Singleton@H@@SAXXZ) referenced in function _mainrn1>Test.obj : error LNK2019: unresolved external symbol "public: static int * __cdecl Singleton::getInstance(void)" (?getInstance@?$Singleton@H@@SAPAHXZ) referenced in function _mainrn1>G:\Code\设计模式\Singleton\Debug\Singleton.exe : fatal error LNK1120: 2 unresolved externals[/color]rn1>rn1>Build FAILED.rn1>rn1>Time Elapsed 00:00:02.62rn========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========rnrnSingleton.hrn[code=c]#ifndef _SINGLETON_H_rn#define _SINGLETON_H_rnrn#include rnrntemplate class Singletonrnrn public:rn static T* getInstance();rn static void DelInstance();rnrn private:rn Singleton()rn ~Singleton()rnrn Singleton(const Singleton &singleton);rn Singleton& operator=(const Singleton &singleton);rnrn private:rn static T *m_pSingleton;rn static CMutex m_singleMutex;rn;rnrn#endif[/code]rnrnSingle.cpprn[code=c]#include "Singleton.h"rnrntemplate T* Singleton::m_pSingleton = 0;rnrntemplate T* Singleton::getInstance()rnrn if (0 == Singleton::m_pSingleton)rn rn Singleton::m_singleMutex.Lock(INFINITE);rnrn if (0 == Singleton::m_pSingleton)rn Singleton::m_pSingleton = new T;rnrn Singleton::m_singleMutex.Unlock();rn rnrn return Singleton::m_pSingleton;rnrnrntemplate void Singleton::DelInstance()rnrn if (0 != Singleton::m_pSingleton)rn rn Singleton::m_singleMutex.Lock(INFINITE);rnrn if (0 != Singleton::m_pSingleton)rn rn delete Singleton::m_pSingleton;rn Singleton::m_pSingleton = 0;rn rnrn Singleton::m_singleMutex.Unlock();rn rn[/code]rnrnTest.cpprn[code=c]#include rn#include "Singleton.h"rnrnusing namespace std;rnrnint main(int argc, char **argv)rnrn int *s1 = 0;rn int *s2 = 0;rn s1 = Singleton::getInstance();rn s2 = Singleton::getInstance();rn cout << s1 << endl;rn cout << s2 << endl;rnrn Singleton::DelInstance();rn system("pause");rn return 0;rn[/code] 论坛

error LNK2028 & error LNK2019

05-26

WordStatProcessor.hrn[code=C/C++]rn#pragma oncernrn#include rn#include rn#include rnrnnamespace WordStat rn class WordStatProcessor rn rn public:rn void process();rn rn private:rn rn ;rnrn[/code]rnrnrnWordStatProcessor.cpprnrn[code=C/C++]rn#include "stdafx.h"rn#include "WordStatProcessor.h"rnrn#include rn#include rn#include rnrnvoid process()rnrn std::ifstream myfile ("c:/example.txt");rn std::string line;rn if (myfile.is_open())rn while (! myfile.eof() )rn std::getline (myfile,line);rn rn myfile.close();rn rnrn[/code]rnrnForm1.hrnrn[code=C/C++]rn#pragma oncernrn#include "WordStatProcessor.h"rnrnnamespace WordStat rnrn using namespace System;rn using namespace System::ComponentModel;rn using namespace System::Collections;rn using namespace System::Windows::Forms;rn using namespace System::Data;rn using namespace System::Drawing;rnrn public ref class Form1 : public System::Windows::Forms::Formrn rn public:rn Form1(void)rn rn InitializeComponent();rn rnrn protected:rn ~Form1()rn rn if (components)rn rn delete components;rn rn rn private: System::Windows::Forms::GroupBox^ groupBox1;rn protected: rn private: System::Windows::Forms::Label^ label1;rn private: System::Windows::Forms::GroupBox^ groupBox2;rn private: System::Windows::Forms::GroupBox^ groupBox3;rn private: System::Windows::Forms::ComboBox^ folderDir;rn private: System::Windows::Forms::Button^ button2;rn private: System::Windows::Forms::Label^ currentState;rn private: System::Windows::Forms::Label^ label2;rn private: System::Windows::Forms::FolderBrowserDialog^ folderBrowserDialog;rnrnrnrn private:rnrn System::ComponentModel::Container ^components;rnrn#pragma region Windows Form Designer generated codernrn void InitializeComponent(void)rn rn ....rn rn#pragma endregionrnprivate: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) rn System::Windows::Forms::DialogResult result = this->folderBrowserDialog->ShowDialog();rn if(result == System::Windows::Forms::DialogResult::OK)rn this->folderDir->Text = this->folderBrowserDialog->SelectedPath;rn rn rnprivate: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) rn WordStat::WordStatProcessor processor;rn processor.process();rn rn;rnrnrnrn[/code]rnrnrn错误rnrn1>------ Build started: Project: WordStat, Configuration: Debug Win32 ------rn1>Compiling...rn1>WordStatProcessor.cpprn1>WordStat.cpprn1>Generating Code...rn1>Linking...rn1>WordStat.obj : error LNK2028: unresolved token (0A000015) "public: void __clrcall WordStat::WordStatProcessor::process(void)" (?process@WordStatProcessor@WordStat@@$$FQAMXXZ) referenced in function "private: void __clrcall WordStat::Form1::button2_Click(class System::Object ^,class System::EventArgs ^)" (?button2_Click@Form1@WordStat@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)rn1>WordStat.obj : error LNK2019: unresolved external symbol "public: void __clrcall WordStat::WordStatProcessor::process(void)" (?process@WordStatProcessor@WordStat@@$$FQAMXXZ) referenced in function "private: void __clrcall WordStat::Form1::button2_Click(class System::Object ^,class System::EventArgs ^)" (?button2_Click@Form1@WordStat@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)rn1>D:\Projects\VisualStudio\WordStat\Debug\WordStat.exe : fatal error LNK1120: 2 unresolved externalsrn1>Build log was saved at "file://d:\Projects\VisualStudio\WordStat\WordStat\Debug\BuildLog.htm"rn1>WordStat - 3 error(s), 0 warning(s)rn========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========rnrn迷糊~~~rnrn 论坛

没有更多推荐了,返回首页