Я выполнил следующие шаги для запуска источника capture2Text
- Загрузите исходный код leptonica 1.74.4, запустите команду cmake и создайте решение в сообществе Visual Studio 2017
- Загрузите исходный код tesseract, запуститеКомандное решение cmake и решение для сборки в сообществе Visual Studio 2017
- Установите Qt creator 5.13
- Импортируйте файл Capture2Text.pro в Qt creator, добавьте пути сборки leptonica и tesseract в include path и libs.
- Я создаю отладочную версию 32-разрядной версии с 32-разрядной версией mvsc 2017, она завершается с 41 ошибкой неразрешенных символов.
Ошибки:
link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST:embed /OUT:debug\Capture2Text.exe @C:\Users\ayadavil\AppData\Local\Temp\Capture2Text.exe.14844.79562.jom
Furigana.obj : error LNK2019: unresolved external symbol _pixGetPixel referenced in function "public: static bool __cdecl Furigana::eraseFuriganaVertical(struct Pix *,float,int *)" (?eraseFuriganaVertical@Furigana@@SA_NPAUPix@@MPAH@Z)
BoundingTextRect.obj : error LNK2001: unresolved external symbol _pixGetPixel
PreProcess.obj : error LNK2001: unresolved external symbol _pixGetPixel
Furigana.obj : error LNK2019: unresolved external symbol _pixClearInRect referenced in function "private: static bool __cdecl Furigana::eraseAreaLeftToRight(struct Pix *,int,int)" (?eraseAreaLeftToRight@Furigana@@CA_NPAUPix@@HH@Z)
CommandLine.obj : error LNK2019: unresolved external symbol _pixDestroy referenced in function "private: class QString __thiscall CommandLine::ocrImageFile(class QString)" (?ocrImageFile@CommandLine@@AAE?AVQString@@V2@@Z)
PreProcess.obj : error LNK2001: unresolved external symbol _pixDestroy
MainWindow.obj : error LNK2001: unresolved external symbol _pixDestroy
CommandLine.obj : error LNK2019: unresolved external symbol _pixWriteImpliedFormat referenced in function "private: class QString __thiscall CommandLine::ocrImageFile(class QString)" (?ocrImageFile@CommandLine@@AAE?AVQString@@V2@@Z)
PreProcess.obj : error LNK2001: unresolved external symbol _pixWriteImpliedFormat
MainWindow.obj : error LNK2001: unresolved external symbol _pixWriteImpliedFormat
PreProcess.obj : error LNK2019: unresolved external symbol _pixOtsuAdaptiveThreshold referenced in function "private: struct Pix * __thiscall PreProcess::binarize(struct Pix *)" (?binarize@PreProcess@@AAEPAUPix@@PAU2@@Z)
PreProcess.obj : error LNK2019: unresolved external symbol _pixUnsharpMaskingGray referenced in function "private: struct Pix * __thiscall PreProcess::unsharpMask(struct Pix *)" (?unsharpMask@PreProcess@@AAEPAUPix@@PAU2@@Z)
PreProcess.obj : error LNK2019: unresolved external symbol _pixDilateBrick referenced in function "public: struct Pix * __thiscall PreProcess::extractBubbleText(struct Pix *,int,int)" (?extractBubbleText@PreProcess@@QAEPAUPix@@PAU2@HH@Z)
PreProcess.obj : error LNK2019: unresolved external symbol _pixCreateTemplate referenced in function "public: struct Pix * __thiscall PreProcess::extractBubbleText(struct Pix *,int,int)" (?extractBubbleText@PreProcess@@QAEPAUPix@@PAU2@HH@Z)
PreProcess.obj : error LNK2019: unresolved external symbol _pixClone referenced in function "public: struct Pix * __thiscall PreProcess::processImage(struct Pix *,bool,bool)" (?processImage@PreProcess@@QAEPAUPix@@PAU2@_N1@Z)
PreProcess.obj : error LNK2019: unresolved external symbol _pixSetPixel referenced in function "public: struct Pix * __thiscall PreProcess::extractBubbleText(struct Pix *,int,int)" (?extractBubbleText@PreProcess@@QAEPAUPix@@PAU2@HH@Z)
PreProcess.obj : error LNK2019: unresolved external symbol _pixAddBlackOrWhiteBorder referenced in function "private: struct Pix * __thiscall PreProcess::addBorder(struct Pix *)" (?addBorder@PreProcess@@AAEPAUPix@@PAU2@@Z)
PreProcess.obj : error LNK2019: unresolved external symbol _pixInvert referenced in function "public: struct Pix * __thiscall PreProcess::processImage(struct Pix *,bool,bool)" (?processImage@PreProcess@@QAEPAUPix@@PAU2@_N1@Z)
PreProcess.obj : error LNK2019: unresolved external symbol _pixAnd referenced in function "public: struct Pix * __thiscall PreProcess::extractBubbleText(struct Pix *,int,int)" (?extractBubbleText@PreProcess@@QAEPAUPix@@PAU2@HH@Z)
PreProcess.obj : error LNK2019: unresolved external symbol _pixAverageInRect referenced in function "public: struct Pix * __thiscall PreProcess::extractTextBlock(struct Pix *,int,int,int,int,int)" (?extractTextBlock@PreProcess@@QAEPAUPix@@PAU2@HHHHH@Z)
PreProcess.obj : error LNK2019: unresolved external symbol _pixClipRectangle referenced in function "public: struct Pix * __thiscall PreProcess::extractTextBlock(struct Pix *,int,int,int,int,int)" (?extractTextBlock@PreProcess@@QAEPAUPix@@PAU2@HHHHH@Z)
PreProcess.obj : error LNK2019: unresolved external symbol _pixClipToForeground referenced in function "public: struct Pix * __thiscall PreProcess::processImage(struct Pix *,bool,bool)" (?processImage@PreProcess@@QAEPAUPix@@PAU2@_N1@Z)
PreProcess.obj : error LNK2019: unresolved external symbol _pixAverageOnLine referenced in function "public: struct Pix * __thiscall PreProcess::processImage(struct Pix *,bool,bool)" (?processImage@PreProcess@@QAEPAUPix@@PAU2@_N1@Z)
PreProcess.obj : error LNK2019: unresolved external symbol _pixSelectBySize referenced in function "private: struct Pix * __thiscall PreProcess::removeNoise(struct Pix *)" (?removeNoise@PreProcess@@AAEPAUPix@@PAU2@@Z)
PreProcess.obj : error LNK2019: unresolved external symbol _pixConvertRGBToGray referenced in function "private: struct Pix * __thiscall PreProcess::makeGray(struct Pix *)" (?makeGray@PreProcess@@AAEPAUPix@@PAU2@@Z)
PreProcess.obj : error LNK2019: unresolved external symbol _pixConvertTo8 referenced in function "private: struct Pix * __thiscall PreProcess::makeGray(struct Pix *)" (?makeGray@PreProcess@@AAEPAUPix@@PAU2@@Z)
PreProcess.obj : error LNK2019: unresolved external symbol _pixConvert24To32 referenced in function "private: struct Pix * __thiscall PreProcess::makeGray(struct Pix *)" (?makeGray@PreProcess@@AAEPAUPix@@PAU2@@Z)
PreProcess.obj : error LNK2019: unresolved external symbol _pixRead referenced in function "public: struct Pix * __thiscall PreProcess::convertImageToPix(class QString)" (?convertImageToPix@PreProcess@@QAEPAUPix@@VQString@@@Z)
PreProcess.obj : error LNK2019: unresolved external symbol _pixReadMem referenced in function "public: struct Pix * __thiscall PreProcess::convertImageToPix(class QImage &)" (?convertImageToPix@PreProcess@@QAEPAUPix@@AAVQImage@@@Z)
PreProcess.obj : error LNK2019: unresolved external symbol _pixScaleGrayLI referenced in function "private: struct Pix * __thiscall PreProcess::scale(struct Pix *)" (?scale@PreProcess@@AAEPAUPix@@PAU2@@Z)
PreProcess.obj : error LNK2019: unresolved external symbol _pixSeedfillBinary referenced in function "public: struct Pix * __thiscall PreProcess::extractBubbleText(struct Pix *,int,int)" (?extractBubbleText@PreProcess@@QAEPAUPix@@PAU2@HH@Z)
PreProcess.obj : error LNK2019: unresolved external symbol _pixRemoveBorderConnComps referenced in function "public: struct Pix * __thiscall PreProcess::extractTextBlock(struct Pix *,int,int,int,int,int)" (?extractTextBlock@PreProcess@@QAEPAUPix@@PAU2@HHHHH@Z)
PreProcess.obj : error LNK2019: unresolved external symbol _pixFindSkewAndDeskew referenced in function "private: struct Pix * __thiscall PreProcess::deskew(struct Pix *)" (?deskew@PreProcess@@AAEPAUPix@@PAU2@@Z)
OcrEngine.obj : error LNK2019: unresolved external symbol "public: __thiscall tesseract::TessBaseAPI::TessBaseAPI(void)" (??0TessBaseAPI@tesseract@@QAE@XZ) referenced in function "public: __thiscall OcrEngine::OcrEngine(void)" (??0OcrEngine@@QAE@XZ)
OcrEngine.obj : error LNK2019: unresolved external symbol "public: bool __thiscall tesseract::TessBaseAPI::SetVariable(char const *,char const *)" (?SetVariable@TessBaseAPI@tesseract@@QAE_NPBD0@Z) referenced in function "public: class QString __thiscall OcrEngine::performOcr(struct Pix *,bool)" (?performOcr@OcrEngine@@QAE?AVQString@@PAUPix@@_N@Z)
OcrEngine.obj : error LNK2019: unresolved external symbol "public: int __thiscall tesseract::TessBaseAPI::Init(char const *,char const *,enum tesseract::OcrEngineMode,char * *,int,class GenericVector<class STRING> const *,class GenericVector<class STRING> const *,bool)" (?Init@TessBaseAPI@tesseract@@QAEHPBD0W4OcrEngineMode@2@PAPADHPBV?$GenericVector@VSTRING@@@@3_N@Z) referenced in function "public: int __thiscall tesseract::TessBaseAPI::Init(char const *,char const *)" (?Init@TessBaseAPI@tesseract@@QAEHPBD0@Z)
OcrEngine.obj : error LNK2019: unresolved external symbol "public: void __thiscall tesseract::TessBaseAPI::ReadConfigFile(char const *)" (?ReadConfigFile@TessBaseAPI@tesseract@@QAEXPBD@Z) referenced in function "public: class QString __thiscall OcrEngine::performOcr(struct Pix *,bool)" (?performOcr@OcrEngine@@QAE?AVQString@@PAUPix@@_N@Z)
OcrEngine.obj : error LNK2019: unresolved external symbol "public: void __thiscall tesseract::TessBaseAPI::SetPageSegMode(enum tesseract::PageSegMode)" (?SetPageSegMode@TessBaseAPI@tesseract@@QAEXW4PageSegMode@2@@Z) referenced in function "public: class QString __thiscall OcrEngine::performOcr(struct Pix *,bool)" (?performOcr@OcrEngine@@QAE?AVQString@@PAUPix@@_N@Z)
OcrEngine.obj : error LNK2019: unresolved external symbol "public: void __thiscall tesseract::TessBaseAPI::SetImage(struct Pix *)" (?SetImage@TessBaseAPI@tesseract@@QAEXPAUPix@@@Z) referenced in function "public: class QString __thiscall OcrEngine::performOcr(struct Pix *,bool)" (?performOcr@OcrEngine@@QAE?AVQString@@PAUPix@@_N@Z)
OcrEngine.obj : error LNK2019: unresolved external symbol "public: char * __thiscall tesseract::TessBaseAPI::GetUTF8Text(void)" (?GetUTF8Text@TessBaseAPI@tesseract@@QAEPADXZ) referenced in function "public: class QString __thiscall OcrEngine::performOcr(struct Pix *,bool)" (?performOcr@OcrEngine@@QAE?AVQString@@PAUPix@@_N@Z)
OcrEngine.obj : error LNK2019: unresolved external symbol "public: void __thiscall tesseract::TessBaseAPI::Clear(void)" (?Clear@TessBaseAPI@tesseract@@QAEXXZ) referenced in function "public: class QString __thiscall OcrEngine::performOcr(struct Pix *,bool)" (?performOcr@OcrEngine@@QAE?AVQString@@PAUPix@@_N@Z)
OcrEngine.obj : error LNK2019: unresolved external symbol "public: void __thiscall tesseract::TessBaseAPI::End(void)" (?End@TessBaseAPI@tesseract@@QAEXXZ) referenced in function "public: __thiscall OcrEngine::~OcrEngine(void)" (??1OcrEngine@@QAE@XZ)
KeyboardHook.obj : error LNK2019: unresolved external symbol __imp__GetKeyState@4 referenced in function "private: static long __stdcall KeyboardHook::hookProc(int,unsigned int,long)" (?hookProc@KeyboardHook@@CGJHIJ@Z)
KeyboardHook.obj : error LNK2019: unresolved external symbol __imp__SendInput@12 referenced in function "private: static long __stdcall KeyboardHook::hookProc(int,unsigned int,long)" (?hookProc@KeyboardHook@@CGJHIJ@Z)
KeyboardHook.obj : error LNK2019: unresolved external symbol __imp__SetWindowsHookExW@16 referenced in function "public: virtual void __thiscall KeyboardHook::run(void)" (?run@KeyboardHook@@UAEXXZ)
MouseHook.obj : error LNK2001: unresolved external symbol __imp__SetWindowsHookExW@16
KeyboardHook.obj : error LNK2019: unresolved external symbol __imp__UnhookWindowsHookEx@4 referenced in function "public: void __thiscall KeyboardHook::endThread(void)" (?endThread@KeyboardHook@@QAEXXZ)
MouseHook.obj : error LNK2001: unresolved external symbol __imp__UnhookWindowsHookEx@4
KeyboardHook.obj : error LNK2019: unresolved external symbol __imp__CallNextHookEx@16 referenced in function "private: static long __stdcall KeyboardHook::hookProc(int,unsigned int,long)" (?hookProc@KeyboardHook@@CGJHIJ@Z)
MouseHook.obj : error LNK2001: unresolved external symbol __imp__CallNextHookEx@16
debug\Capture2Text.exe : fatal error LNK1120: 41 unresolved externals
jom: C:\Code\Capture2Text_v4.6.2_Source_Code\build-Capture2Text-Desktop_x86_windows_msys_pe_32bit-Debug\Makefile.Debug [debug\Capture2Text.exe] Error 1120
jom: C:\Code\Capture2Text_v4.6.2_Source_Code\build-Capture2Text-Desktop_x86_windows_msys_pe_32bit-Debug\Makefile [debug] Error 2
11:43:19: The process "C:\Qt\Qt5.13.1\Tools\QtCreator\bin\jom.exe" exited with code 2.
Error while building/deploying project Capture2Text (kit: Desktop (x86-windows-msys-pe-32bit))
When executing step "Make"
11:43:19: Elapsed time: 01:29.
Capture2Text.pro
файл:
QT += core
QT += qml
QT += widgets
!console {
QT += gui network texttospeech
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
}
TARGET = Capture2Text
console {
TARGET = Capture2Text_CLI
}
TEMPLATE = app
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# Disable warning: C4305: 'initializing': truncation from 'double' to 'l_float32'
QMAKE_CXXFLAGS += /wd4305
# Disable warning: C4099: 'ETEXT_DESC': type name first seen using 'class' now seen using 'struct'
QMAKE_CXXFLAGS += /wd4099
#QMAKE_CXXFLAGS += -std=c++11
console {
DEFINES += CLI_BUILD
}
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += main.cpp\
Furigana.cpp \
BoundingTextRect.cpp \
RunGuard.cpp \
CommandLine.cpp \
UtilsLang.cpp \
UtilsImg.cpp \
PostProcess.cpp \
PreProcess.cpp \
OcrEngine.cpp \
UtilsCommon.cpp
HEADERS += \
Furigana.h \
BoundingTextRect.h \
CommandLine.h \
UtilsLang.h \
UtilsImg.h \
PostProcess.h \
PreProcess.h \
PreProcessCommon.h \
OcrEngine.h \
UtilsCommon.h
!console {
SOURCES += \
MainWindow.cpp \
SettingsDialog.cpp \
Settings.cpp \
PopupDialog.cpp \
Preview.cpp \
SampleBox.cpp \
Translate.cpp \
Hotkey.cpp \
HotkeyWidget.cpp \
CaptureBox.cpp \
AboutDialog.cpp \
WelcomeDialog.cpp \
KeyboardHook.cpp \
MouseHook.cpp \
Speech.cpp
HEADERS += \
MainWindow.h \
RunGuard.h \
SettingsDialog.h \
Preview.h \
Settings.h \
PopupDialog.h \
SampleBox.h \
Translate.h \
Hotkey.h \
HotkeyWidget.h \
CaptureBox.h \
AboutDialog.h \
ReplyTimeout.h \
WelcomeDialog.h \
KeyboardHook.h \
MouseHook.h \
Speech.h
FORMS += \
SettingsDialog.ui \
PopupDialog.ui \
HotkeyWidget.ui \
AboutDialog.ui \
WelcomeDialog.ui
}
INCLUDEPATH += C:\Code\tesseract\src\api
INCLUDEPATH += C:\Code\tesseract\src\ccmain
INCLUDEPATH += C:\Code\tesseract\src\ccstruct
INCLUDEPATH += C:\Code\tesseract\src\ccutil
INCLUDEPATH += C:\Code\tesseract\tesseract-lib
INCLUDEPATH += C:\Code\leptonica2\leptonica-1.74.4
INCLUDEPATH += C:\Code\leptonica2\leptonica-1.74.4\src
INCLUDEPATH += C:\Code\leptonica2\leptonica-1.74.4\build\src
INCLUDEPATH += C:\Code\leptonica2\leptonica-1.74.4\build\bin
INCLUDEPATH += C:\Code\leptonica2\leptonica-1.74.4\build\src\leptonica.dir\Debug
INCLUDEPATH += C:\Code\qt-everywhere-src-5.13.1.tar\qt-everywhere-src-5.13.1
INCLUDEPATH += C:\Code\qt5
INCLUDEPATH += C:\Code\Capture2Text_v4.6.2_32bit\Capture2Text
#INCLUDEPATH += C:\Windows\SysWOW64
#INCLUDEPATH += C:\Code\Capture2Text_v4.6.2_Source_Code\build-Capture2Text-Desktop_Qt_5_13_1_MSVC2017_32bit-Debug\debug
# Tesseract and leptonica
bits32 {
# 32-bit
win32:CONFIG(release, debug|release): LIBS += -LC:\Code\leptonica2\leptonica-1.74.4\build \
-LC:\Code\leptonica2\leptonica-1.74.4\src \
-LC:\Code\leptonica2\leptonica-1.74.4\build\bin \
-LC:\Code\leptonica2\leptonica-1.74.4\build\src \
-LC:\Code\leptonica2\leptonica-1.74.4\build\src\leptonica.dir\Debug \
-LC:\Code\tesseract\bin \
-LC:\Code\tesseract\build\Release \
-LC:\Code\tesseract\build\libtesseract.dir\Release \
-LC:\Code\qt-everywhere-src-5.13.1.tar\qt-everywhere-src-5.13.1\qtwebengine\src\3rdparty\chromium\third_party\swiftshader\third_party\PowerVR_SDK\Builds\Windows\x86_32\Lib \
-LC:\Windows\System32 \
-Ltesseract400
else:win32:CONFIG(debug, debug|release): LIBS += -LC:\Code\leptonica2\leptonica-1.74.4\build \
-LC:\Code\leptonica2\leptonica-1.74.4\src \
-LC:\Code\leptonica2\leptonica-1.74.4\build\bin \
-LC:\Code\leptonica2\leptonica-1.74.4\build\src \
-LC:\Code\leptonica2\leptonica-1.74.4\build\src\leptonica.dir\Debug \
-LC:\Code\tesseract\bin \
-LC:\Code\tesseract\build\bin\Debug \
-LC:\Code\tesseract\build\libtesseract.dir\Debug \
-LC:\Code\qt-everywhere-src-5.13.1.tar\qt-everywhere-src-5.13.1\qtwebengine\src\3rdparty\chromium\third_party\swiftshader\third_party\PowerVR_SDK\Builds\Windows\x86_32\Lib \
-LC:\Windows\System32 \
-Ltesseract400d
} else {
# 64-bit
win32:CONFIG(release, debug|release): LIBS += -LC:\Code\leptonica2\leptonica-1.74.4\build \
-LC:\Code\leptonica2\leptonica-1.74.4\src \
-LC:\Code\leptonica2\leptonica-1.74.4\build\bin \
-LC:\Code\leptonica2\leptonica-1.74.4\build\src \
-LC:\Code\tesseract\build\bin\x64\Debug \
-LC:\Code\qt-everywhere-src-5.13.1.tar\qt-everywhere-src-5.13.1\qtwebengine\src\3rdparty\chromium\third_party\swiftshader\third_party\PowerVR_SDK\Builds\Windows\x64\Lib \
-LC:\Windows\SysWOW64 \
-Ltesseract500
else:win32:CONFIG(debug, debug|release): LIBS += -LC:\Code\leptonica2\leptonica-1.74.4\build \
-LC:\Code\leptonica2\leptonica-1.74.4\src \
-LC:\Code\leptonica2\leptonica-1.74.4\build\bin \
-LC:\Code\leptonica2\leptonica-1.74.4\build\src \
-LC:\Code\tesseract\build\bin\x64\Debug \
-LC:\Code\qt-everywhere-src-5.13.1.tar\qt-everywhere-src-5.13.1\qtwebengine\src\3rdparty\chromium\third_party\swiftshader\third_party\PowerVR_SDK\Builds\Windows\x64\Lib \
-Ltesseract500d
}
#LIBS += -Lpvt.cppan.demo.danbloomberg.leptonica\leptonica-1.74.4
#LIBS += -Luser32
LIBS += -Llept
LIBS += -Ltesseract
#LIBS += -LC:\Code\Capture2Text_v4.6.2_Source_Code\build-Capture2Text-Desktop_Qt_5_13_1_MSVC2017_32bit-Debug\debug
!console {
RESOURCES += \
resource.qrc
}
# Needed for the icon
RC_FILE = Capture2Text.rc