gpt4 book ai didi

C++ - 在 MFC 中使用 Hunspell

转载 作者:搜寻专家 更新时间:2023-10-31 01:15:46 26 4
gpt4 key购买 nike

After I managed to get Hunspell working with a Win32 console application ,我想在同一解决方案的 MFC 应用程序中使用 Hunspell。当我尝试编译 MFC 应用程序时出现以下错误。

spellcheck\hunspell-src\hunspell\replist.hxx(23): error C2062: type 'const char' unexpected
spellcheck\hunspell-src\hunspell\replist.hxx(23): error C2238: unexpected token(s) preceding ';'

关于解决方案的一些信息:

  • 该解决方案称为拼写检查。
  • Hunspell 源文件位于 spellcheck\hunspell-src\hunspellspellcheck\hunspell-src\win_api
  • 项目libhunspell 已导入并编译无误。
  • 解决方案中的控制台应用程序使用相同的 hunspell dll/源文件并且没有错误
  • 控制台应用程序已相应地设置为 this thread
  • HunSpell-SrcHunSpell-Dic 文件夹不在项目文件夹中,而是在解决方案文件夹 spellcheck 中,并已正确引用。

我已按如下方式设置 MFC 应用程序:

  1. 将新的 MFC 应用程序 (SDI) 作为项目添加到名为 MFC2 的解决方案中。
  2. MFC2 中添加了对项目 libhunspell 的引用。
  3. Project > Properties > Configuration Properties > C++ > General > Additional Include Directories 已设置为:..\hunspell-src\hunspell;%(AdditionalIncludeDirectories) (与控制台应用程序相同)
  4. Project > Properties > Configuration Properties > Linker > General > Additional Library Directories 已设置为:..\hunspell-src\win_api\Debug_dll\libhunspell;%(AdditionalLibraryDirectories)(与控制台应用程序相同)
  5. Mainfrm.cpp中的#include MainFrm.h下添加了#include "../HunSpell-Src/win_api/hunspelldll.h" >.

我决定将 hunspelldd.h 的 #include 放在 Mainfrm.cpp 中,并省略设置对话框和调用它,以使这个问题尽可能短可能的。尽管如此,我已经按照所述设置了一个项目,该项目会产生上述错误消息。

因为控制台应用程序可以正常编译,所以我假设某些特定于 MFC 的东西导致了问题。

感谢您的帮助。

最佳答案

在replist.hxx 类声明前添加"#undef near"

关于C++ - 在 MFC 中使用 Hunspell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9735872/

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