Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] How to use Hunspell in Qt on Windows system
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] How to use Hunspell in Qt on Windows system

Scheduled Pinned Locked Moved General and Desktop
12 Posts 2 Posters 6.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi,

    First thing to do: change the backslashes, either escape them or use the unix notation since Qt supports that on Windows.

    By the way, what compiler are you using ?

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    0
    • F Offline
      F Offline
      floreal797
      wrote on last edited by
      #3

      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.

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #4

        Looks like you are trying to link a MinGW library to your MSVC build, aren't you ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • F Offline
          F Offline
          floreal797
          wrote on last edited by
          #5

          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.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #6

            Are you sure that both parameters contains valid paths ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • F Offline
              F Offline
              floreal797
              wrote on last edited by
              #7

              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?

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #8

                Sorry, I meant the parameters you are passing to the Hunspell constructor

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • F Offline
                  F Offline
                  floreal797
                  wrote on last edited by
                  #9

                  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...

                  1 Reply Last reply
                  0
                  • F Offline
                    F Offline
                    floreal797
                    wrote on last edited by
                    #10

                    I have also tried to copy dic files from linux to windows to use exactly the sames, but it does not solve the problem

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #11

                      Does the debugger give you more information about where exactly it crashes in Hunspell's library ?

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #12

                        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

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved