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. Dynamically linking to Hunspell
Qt 6.11 is out! See what's new in the release blog

Dynamically linking to Hunspell

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 3.5k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    I have a project in which I would like to dynamically link to the Hunspell library so my app can have spell-check. The only problem is, I have no idea how to do it. I'm more familiar with the concept in Visual Studio/ C# but I've never done it in a Qt/C++ app before. I did some research and I learned how to put a reference to the library in my project file but I still haven't figured out how to #include it in the classes that need it (the library never shows up in that list Qt Creator offers for includes). Hopefully it's the correct library; It's the libhunspell-1.3.so.0 file from Ubuntu's "libhunspell-1.3-0" package.

    I intend to release on Linux and Windows (and maybe Mac at some point, if I ever find a way to maintain the app on that platform). I know most Linux distros have ready-made Hunspell libraries in their repositories. I hope I can use those to prevent any potential distribution/licensing pitfalls. On Windows I'll probably have to roll my own DLL from source but hopefully the process of linking against it will be the same.

    This part of Qt programming is completely new to me so I would really appreciate any info/help you guys can give me. Thanks in advance.

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

      Hi,

      First thing to do is to install the hunspell dev package if you didn't do that already.

      If you still can't get the include working after that, check where the hunspell includes can be found and add the path to INCLUDEPATH.

      For the linking part, it should look like:

      @LIBS += -lhunspell-1.3@

      If for any reason the library can't be found:

      @LIBS += -L/path/to/where_libhunspell.so_can_be_found@

      For the Mac port, you can have hunspell from e.g. macport or brew, you'll have to adapt some path but compiling the application itself should not be problematic. However, the deployment is a bit more complex (but assisted by e.g. macdeployqt)

      On windows, again, most of the time it will be a question of path to correct, the deployment is also less easy but not overly complicated, you have a fine "wiki entry":http://qt-project.org/wiki/Deploy_an_Application_on_Windows to help you (if curious about gory details, take a look at Qt's documentation)

      Hope it helps

      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
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        Thanks, that definitely helped.

        I got this working on Ubuntu/other distros in the Debian family but I'm having trouble with Fedora b/c there seems to be no hunspell-dev equivalent package on that distro (just dictionaries for various languages). I need a package that has both headers and libraries in it. If I can't find a solution, I may have to abandon Fedora support. It's a real shame but I don't know if I can make this work on every flavor of Linux out there, especially if there aren't packages I can use as dependencies.

        In the meantime, I'm going to start working on the Windows part.

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

          You should ask the Fedora guys about their support for hunspell/hunspell dev package

          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
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5

            On Fedora you have 'hunspell-devel'
            $ sudo yum install hunspell-devel

            1 Reply Last reply
            0
            • ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #6

              On Fedora you have 'hunspell-devel'
              $ sudo yum install hunspell-devel

              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