My goal is to create a simple Win32 Console application that uses HunSpell to spell-check a word the user has entered. I tried to follow this codeproject tutorial which is for Visual Studio 2008 and HunSpell 1.2.1.
I don’t want to use the provided code, since I intend to write my own. Furthermore I want to add HunSpell as a dll, not as a static library.
Following are the steps I took:
- Created a Win32 console (empty) project with the name myproject.
- Downloaded HunSpell 1.3.2 from SourceForge.org.
- Copied hunspell-1.3.2\src\hunspell and win_api to myproject\myproject\HunSpell-Src
- Added and converted project libhunspell myproject\myproject\HunSpell-Src\win-api\libhunspell.vcproj to the solution.
- Made my debug build use debug_dll and my release build release_dll of libhunspell in the Configuration Manager.
- Rebuilt the libhunspell project, libhunspell.dll is generated in debug_dll and release_dll folders respectively.
- Made my console project depend on libhunspell. (Added reference to libhunspell)
- Copied dictionary files en_US.aff & en_US.dic to myproject\myproject\HunSpell-Dic after downloading them from SourceForge.org.
I can’t figure out how/where to add the processor define HSPELLEDIT_DLL that is mentioned in the codeproject tutorial.
Following the steps listed under “To use the functionality from the class library in the console application” on MSDN didn’t changed the result.
I want to test it with a program like this:
#include <iostream>
#include "HunSpell-Src/win_api/hunspelldll.h"
using namespace std;
void main()
{
void *spellObj = 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(spellObject);
}
VS produces the following error message if I try to compile it:
myproject\myproject\hunspell-src\win_api\hunspelldll.h(34): fatal error C1083: Cannot open include file: 'hunspell.hxx': No such file or directory
Hunspell.hxx is present in myproject\myproject\HunSpell-Src\hunspell. IntelliSense marks the #include "hunspell.hxx" as an error while the tab hasn’t focus with the message “Error: cannot open source file hunspell.hxx”, but after giving focus to it the error disappears.
Thank you for your help.