2013-03-29 89 views
0

好的。所以我使用Visual Studio 2010 - > Visual C++和.NET框架(Windows窗體應用程序),當我嘗試用hashlib ++散列字符串時,我得到多個LNK錯誤。C和hashlib LNK錯誤

這是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)" ([email protected]@[email protected]) referenced in function "private: void __clrcall Launcher::Form1::button1_Click(class System::Object ^,class System::EventArgs ^)" ([email protected]@[email protected]@[email protected]@@[email protected]@@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)" ([email protected]@[email protected]) referenced in function "private: void __clrcall Launcher::Form1::button1_Click(class System::Object ^,class System::EventArgs ^)" ([email protected]@[email protected]@[email protected]@@[email protected]@@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錯誤。 :\

+0

我從C++重新命名爲C++ - CLI – JBentley

回答