Question

After I managed to get Hunspell working with a Win32 console application, I want to use Hunspell in an MFC application in the same solution. I get the following error when I try to compile the MFC application.

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 ';'

Some information about the solution:

  • The solution is called spellcheck.
  • The Hunspell source files are located in spellcheck\hunspell-src\hunspell and spellcheck\hunspell-src\win_api.
  • The project libhunspell has been imported and compiles without errors.
  • A console application in the solution uses the same hunspell dll/source files and has no errors.
  • The console application has been setup accordingly to this thread
  • The folders HunSpell-Src and HunSpell-Dic are NOT located in a project folder but in the solution folder spellcheck and referenced properly.

I have setup the MFC application as following:

  1. Added a new MFC application (SDI) as project to the solution called MFC2.
  2. Added a reference to the project libhunspell to MFC2.
  3. Project > Properties > Configuration Properties > C++ > General > Additional Include Directories has been set to: ..\hunspell-src\hunspell;%(AdditionalIncludeDirectories) (the same as the console application)
  4. Project > Properties > Configuration Properties > Linker > General > Additional Library Directories has been set to: ..\hunspell-src\win_api\Debug_dll\libhunspell;%(AdditionalLibraryDirectories) (the same as the console application)
  5. Added #include "../HunSpell-Src/win_api/hunspelldll.h"under #include MainFrm.h in Mainfrm.cpp.

I decided to put the #include of hunspelldd.h in Mainfrm.cpp and omit setting up a dialog and calling it in order to keep this question as short as possible. Nevertheless I have setup a project as described that produces said error messages.

Because the console application compiles fine, I assume something MFC specific is causing the problem.

Thank you for your help.

Was it helpful?

Solution

Add "#undef near" before class declaration in replist.hxx

OTHER TIPS

I'd look for an error in the include file just before replist.hxx, perhaps a missing ending semicolon on a class definition.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top