2013-05-07 79 views
1

我已經搜索並發現了一堆關於使用Hunspell的文章,但到目前爲止他們都沒有真正幫助我。 C++ - Using HunSpell 1.3.2 with Visual Studio 2010似乎正是我想要做的,但在跟隨問題,答案和鏈接材料後,我仍然遇到問題。簡單的C++控制檯應用程序使用Hunspell

基本上,我對C++很陌生,正在努力學習如何將Hunspell整合到我正在開發的應用程序中。由於這對我來說是新的,我試着從創建一個簡單的控制檯應用程序開始,然後從那裏開始。

這裏是我到目前爲止(再次,我緊跟在鏈接的問題列出的所有步驟)

#include "stdafx.h" 
#include <iostream> 
#include <string> 

#include <hunspelldll.h> 

using namespace std; 

int _tmain(int argc, _TCHAR* argv[]) 
{ 
Hunspell *spellObj = (Hunspell *)hunspell_initialize("HunSpell-dic\\en_us.aff", 
    "HunSpell-dic\\en_us.dic"); 

char str[60]; 
cin >> str; 

int result = hunspell_spell(spellObj, str); 

if (result==0) 
    cout << "Spelling Error!"; 
else 
    cout << "Correct Spelling!"; 

hunspell_uninitialize(spellObj); 
return 0; 
} 

我已經添加了路徑,以我的配置屬性,並給鏈接,但當我建,我得到以下錯誤:

Error 1 error LNK2019: unresolved external symbol __imp__hunspell_uninitialize referenced in function _wmain C:\Users\owner\Documents\My Code Vault\Sandbox\2010Sandbox\Console_Spellcheck\Console_Spellcheck.obj Console_Spellcheck 
Error 2 error LNK2019: unresolved external symbol __imp__hunspell_spell referenced in function _wmain C:\Users\owner\Documents\My Code Vault\Sandbox\2010Sandbox\Console_Spellcheck\Console_Spellcheck.obj Console_Spellcheck 
Error 3 error LNK2019: unresolved external symbol __imp__hunspell_initialize referenced in function _wmain C:\Users\owner\Documents\My Code Vault\Sandbox\2010Sandbox\Console_Spellcheck\Console_Spellcheck.obj Console_Spellcheck 
Error 4 error LNK1120: 3 unresolved externals C:\Users\owner\Documents\My Code Vault\Sandbox\2010Sandbox\Debug\Console_Spellcheck.exe Console_Spellcheck 

我敢肯定,這只是一些簡單的我已經錯過了作爲新來這個,但我一直在拉我的頭髮幾個小時就可以用到目前爲止沒有運氣。任何建議將與肆無忌憚的感激:-)

回答

0

你需要指定的.lib文件作爲附加的鏈接器輸入依賴

+0

試過,結果相同。我必須在這裏做錯事。即使在構建項目之後(在我遇到錯誤之前),它從未生成libhunspell.dll文件。我傾注了我發現的所有指示,但我認爲我只是這麼新而已,我錯過了被視爲「理所當然」項目的東西。 – 98cafe 2013-05-08 00:31:57