本文介绍了C和hashlib LNK错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
好的。所以我使用Visual Studio 2010 - > Visual C ++和.NET框架(Windows窗体应用程序),当我尝试哈希一个字符串与hashlib ++我得到多个LNK错误。
Okay. So i am using Visual Studios 2010 -> Visual C++ and the .NET Framework (Windows Forms Application) and when i try to hash a string with the hashlib++ i get multiple LNK errors.
这是hashlib ++:
This is hashlib++ : http://hashlib2plus.sourceforge.net/
这是我的哈希代码:
//I have more Includes but according to http://hashlib2plus.sourceforge.net/example.html these are the only ones required for hashlib++ so these are the ones i am putting on display.
#include <string>
#include <iostream>
#include <hashlibpp.h>
//I skipped adding namespaces to my display code
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
try{
String^ atmp_user = textBox1->Text;
String^ user = (myReader->GetString(1));//Connecting to MySQL Databases and grabbing usernames
String^ atmp_pass = textBox2->Text;
String^ pass = (myReader->GetString(2));
atmp_pass->ToLower();//LowerCase
atmp_user->ToLower();
String^ total1 = gcnew String(atmp_user+atmp_pass);
string totala;
MarshalString(total1, totala);//Converting String^ to an std::string
hashwrapper *myWrapper = new sha1wrapper();//SHA1 code begins
string hash1 = myWrapper->getHashFromString(totala);
delete myWrapper;//SHA1 code ends
if(atmp_user == user && hash1 == pass){
textBox1->Text = ("It worked!");
}
}
} catch(Exception^ex) {
MessageBox::Show(ex->Message);
}
}
这是我的错误日志:
Error 2 error LNK2028: unresolved token (0A00001E) "public: __clrcall sha1wrapper::sha1wrapper(void)" (??0sha1wrapper@@$$FQAM@XZ) referenced in function "private: void __clrcall Launcher::Form1::button1_Click(class System::Object ^,class System::EventArgs ^)" (?button1_Click@Form1@Launcher@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z) C:\Users\Jeremy\Documents\Visual Studio 2010\Projects\Launcher\Launcher\Launcher.obj
Error 3 error LNK2019: unresolved external symbol "public: __clrcall sha1wrapper::sha1wrapper(void)" (??0sha1wrapper@@$$FQAM@XZ) referenced in function "private: void __clrcall Launcher::Form1::button1_Click(class System::Object ^,class System::EventArgs ^)" (?button1_Click@Form1@Launcher@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z) C:\Users\Jeremy\Documents\Visual Studio 2010\Projects\Launcher\Launcher\Launcher.obj
Error 4 error LNK1120: 2 unresolved externals C:\Users\Jeremy\Documents\Visual Studio 2010\Projects\Launcher\Release\Launcher.exe
任何帮助将非常感谢家人。 :)我一直在努力工作,只是创建一个安全的登录脚本在过去几天。我总是跑到LNK错误无处不在我去。 :\
Any help would be greatly appreciated guys. :) I have been working very hard on just creating a secure login script for the past few days. I keep running into LNK errors everywhere i go. :\
推荐答案
解决。我不得不关闭预编译头文件。
Solved. I had to turn off precompiled headers.
这篇关于C和hashlib LNK错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!