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. QT undefined reference to tesseract::TessBaseAPI::TessBaseAPI()
Forum Update on Monday, May 27th 2025

QT undefined reference to tesseract::TessBaseAPI::TessBaseAPI()

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 666 Views
  • 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.
  • K Offline
    K Offline
    kapabahwuk
    wrote on 26 Jun 2022, 23:04 last edited by
    #1

    Code sample

    #include <tesseract/baseapi.h>
    #include <leptonica/allheaders.h>

    #include <iostream>

    using namespace std;

    int main()
    {
    char *outText;

    tesseract::TessBaseAPI *api = new tesseract::TessBaseAPI();
    

    }
    getting error

    C:\Users\66820\Documents\Tess\main.cpp:14: error: undefined reference to `tesseract::TessBaseAPI::TessBaseAPI()'

    Pro File TEMPLATE = app

    CONFIG += console

    CONFIG -= app_bundle

    CONFIG -= qt

    SOURCES += main.cpp

    LIBS +=-LC:\new\lib

    -ltesseract3.02.02.dll

    -llept.dll

    -ltesseract

    -lstdc++

    INCLUDEPATH+=C:\new\include\

    INCLUDEPATH+=C:\new\include\leptonica

    INCLUDEPATH += C:\tesseract-ocr\api

    changed pro.file to

    TEMPLATE = app
    CONFIG += console
    CONFIG -= app_bundle
    CONFIG -= qt

    SOURCES += main.cpp

    LIBS +=-LC:\new\lib
    -ltesseract3.02.02.dll
    -lllept.dll\

    INCLUDEPATH+=C:\new\include
    getting new errors:

    :-1: error: cannot find -ltesseract3.02.02.dll
    :-1: error: cannot find -lllept.dllScreenshot_1.png

    J 1 Reply Last reply 27 Jun 2022, 05:34
    0
    • K kapabahwuk
      26 Jun 2022, 23:04

      Code sample

      #include <tesseract/baseapi.h>
      #include <leptonica/allheaders.h>

      #include <iostream>

      using namespace std;

      int main()
      {
      char *outText;

      tesseract::TessBaseAPI *api = new tesseract::TessBaseAPI();
      

      }
      getting error

      C:\Users\66820\Documents\Tess\main.cpp:14: error: undefined reference to `tesseract::TessBaseAPI::TessBaseAPI()'

      Pro File TEMPLATE = app

      CONFIG += console

      CONFIG -= app_bundle

      CONFIG -= qt

      SOURCES += main.cpp

      LIBS +=-LC:\new\lib

      -ltesseract3.02.02.dll

      -llept.dll

      -ltesseract

      -lstdc++

      INCLUDEPATH+=C:\new\include\

      INCLUDEPATH+=C:\new\include\leptonica

      INCLUDEPATH += C:\tesseract-ocr\api

      changed pro.file to

      TEMPLATE = app
      CONFIG += console
      CONFIG -= app_bundle
      CONFIG -= qt

      SOURCES += main.cpp

      LIBS +=-LC:\new\lib
      -ltesseract3.02.02.dll
      -lllept.dll\

      INCLUDEPATH+=C:\new\include
      getting new errors:

      :-1: error: cannot find -ltesseract3.02.02.dll
      :-1: error: cannot find -lllept.dllScreenshot_1.png

      J Online
      J Online
      jsulm
      Lifetime Qt Champion
      wrote on 27 Jun 2022, 05:34 last edited by
      #2

      @kapabahwuk said in QT undefined reference to tesseract::TessBaseAPI::TessBaseAPI():

      LIBS +=-LC:\new\lib
      -ltesseract3.02.02.dll
      -lllept.dll\

      Use forward slashes in paths:

      LIBS +=-LC:/new/lib \
      -ltesseract3.02.02.dll \
      -lllept.dll
      

      For linking on Windows you need *.lib files, not *.dll files (those are needed when executing the app).
      It should look like this then:

      LIBS += "C:/new/lib/tesseract3.02.02.lib" \
      "C:/new/lib/llept.lib"
      

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      K 1 Reply Last reply 27 Jun 2022, 20:30
      3
      • J jsulm
        27 Jun 2022, 05:34

        @kapabahwuk said in QT undefined reference to tesseract::TessBaseAPI::TessBaseAPI():

        LIBS +=-LC:\new\lib
        -ltesseract3.02.02.dll
        -lllept.dll\

        Use forward slashes in paths:

        LIBS +=-LC:/new/lib \
        -ltesseract3.02.02.dll \
        -lllept.dll
        

        For linking on Windows you need *.lib files, not *.dll files (those are needed when executing the app).
        It should look like this then:

        LIBS += "C:/new/lib/tesseract3.02.02.lib" \
        "C:/new/lib/llept.lib"
        
        K Offline
        K Offline
        kapabahwuk
        wrote on 27 Jun 2022, 20:30 last edited by
        #3

        @jsulm Thanks, Solved!

        C 1 Reply Last reply 14 Nov 2023, 08:01
        1
        • K kapabahwuk
          27 Jun 2022, 20:30

          @jsulm Thanks, Solved!

          C Offline
          C Offline
          CLOP
          wrote on 14 Nov 2023, 08:01 last edited by
          #4

          @kapabahwuk tesseract3.02.02.dll and llept.dll can you share? 1721849726@qq.com Thank you

          1 Reply Last reply
          0
          • JonBJ JonB referenced this topic on 27 Dec 2024, 22:46

          • Login

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