[SOLVED] How to use Hunspell in Qt on Windows system
-
Hi,
I used slashes instead of backslashes first and I had the same errors.
I am using microsoft visual studio c++ 11.0 (2012), as it is the default complator that Qt propose me.
-
Looks like you are trying to link a MinGW library to your MSVC build, aren't you ?
-
Ok,
I have tried using MinGW to compile my project. First, it does not work with the hunspell I have.
I search and I found a mingw version of hunspell, here:
https://github.com/zdenop/hunspell-mingw
(I use the zip compiled in Windows XP that they give).I try with it.
My .pro file contains now:
@win32 {
INCLUDEPATH += C:/hunspell/include
LIBS += C:/hunspell/lib/libhunspell.a
}@My program start now successfully... but when I push the button to begin spell checking the program crash. With debug, I found it crash on that line, in spellchecker.cpp:
@ _hunspell = new Hunspell(affixFilePathBA.constData(), dictFilePathBA.constData());@Do you know why and how solve the problem?
Thank you for your help, and in advance for your future help. It's really important for me to find a solution.
Floréal.
-
Are you sure that both parameters contains valid paths ?
-
For the INCLUDEPATH yes, it is like author say (http://qt-project.org/wiki/Spell-Checking-with-Hunspell).
For the LIBS, it is written a file to a .lib file but I don't find any .lib file. I think .lib file is for visual studio project as compilation of hunspell with visual studio generate a .lib file.
For linux, we have to use a .a file, so as it was a .a file in the lib directory of hunspell I use it.
Do you think the errors are in these paths?
-
Sorry, I meant the parameters you are passing to the Hunspell constructor
-
I think yes.
files are in C:\hunspell\dics\ and are named fr.dic and fr.aff.
So I use C:/hunspell/dics/fr as the base name and I have checked the program suffix files with .dic and .aff before calling Hunspell constructor.
This part work very well on linux (with its own path, of course), with exactly the same code. I don't know why it crash only on windows...
-
I have also tried to copy dic files from linux to windows to use exactly the sames, but it does not solve the problem
-
Does the debugger give you more information about where exactly it crashes in Hunspell's library ?
-
Indeed, especially on Windows, you have to ensure you use the same compiler for all libraries e.g. MSVC's compilers are not compatible between versions. MinGW should be more flexible but is also known to break compatibility from time to time