gpt4 book ai didi

c++ - 使用 Hunspell 的简单 C++ 控制台应用程序

转载 作者:太空宇宙 更新时间:2023-11-04 14:06:59 25 4
gpt4 key购买 nike

我搜索并找到了一堆关于使用 Hunspell 的文章,但到目前为止,没有一篇真正对我有帮助。 C++ - Using HunSpell 1.3.2 with Visual Studio 2010似乎正是我想要做的,但在按照问题、答案和链接 Material 进行操作后,我仍然遇到问题。

基本上,我是 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

我确信这只是一些简单的东西,我错过了这个新手,但我已经在这上面拉了几个小时,但到目前为止没有运气。任何建议都会得到无限的感激:-)

最佳答案

您需要将 .lib 文件指定为附加的链接器输入依赖项

关于c++ - 使用 Hunspell 的简单 C++ 控制台应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16430188/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com