我正在使用示例代码来运行asprise库,但是当我编译时向我展示了一个我不理解的错误,请问有人可以帮助我吗?
我是使用c ++中的extern库的新手
#include <iostream>
#include "asprise_ocr_api.h"
using namespace std;
void testOcr() {
// CHANGE TO THE ACTUAL PATH to the folder where the aocr.dll or aocr.so locates in
const char * libFolder = "/home/jesus/Descargas/LIB_FOLDER/libaocr_x64.so";
// CHANGE TO THE ACTUAL PATH to the input image, can be jpeg, gif, png, tiff or pdf.
const char * fileImg = "/home/jesus/Descargas/out.tiff";
LIBRARY_HANDLE libHandle = dynamic_load_aocr_library(libFolder);
// one time setup
int setup = c_com_asprise_ocr_setup(false);
if (setup != 1) {
cerr << "Failed to setup. code: " << setup << endl;
return;
}
// starts the ocr engine; the pointer must be of long long type
long long ptrToApi = c_com_asprise_ocr_start("eng", OCR_SPEED_FAST, NULL, NULL, NULL);
if (ptrToApi == 0) {
cerr << "Failed to start." << endl;
return;
}
char * s = c_com_asprise_ocr_recognize(ptrToApi, fileImg, -1, -1, -1, -1, -1,
OCR_RECOGNIZE_TYPE_ALL, OCR_OUTPUT_FORMAT_PDF,
"PROP_PDF_OUTPUT_FILE=result.pdf|PROP_PDF_OUTPUT_TEXT_VISIBLE=true|\
PROP_PDF_OUTPUT_RETURN_TEXT=text", "|", "=");
cout << "Returned: " << s << endl;
// do more recognition here ...
// finally, stops the OCR engine.
c_com_asprise_ocr_stop(ptrToApi);
cout << "Unload: " << (dynamic_unload_aocr_library(libHandle) ? "OK" : "Failed") << endl;
}
int main() { // Entry point
testOcr();
std::cout << "Press ENTER to exit: ";
std::cin.ignore();
return 0;
}
错误是:
/tmp/ccqY74eR.o: En la función `dynamic_load_aocr_library(char const*)':
aspr.cpp:(.text+0x1c5): referencia a `dlopen' sin definir
aspr.cpp:(.text+0x1db): referencia a `dlerror' sin definir
aspr.cpp:(.text+0x20f): referencia a `dlsym' sin definir
aspr.cpp:(.text+0x22c): referencia a `dlsym' sin definir
aspr.cpp:(.text+0x249): referencia a `dlsym' sin definir
aspr.cpp:(.text+0x266): referencia a `dlsym' sin definir
aspr.cpp:(.text+0x283): referencia a `dlsym' sin definir
/tmp/ccqY74eR.o:aspr.cpp:(.text+0x2a0): más referencias a `dlsym' sin definir a continuación
/tmp/ccqY74eR.o: En la función `dynamic_unload_aocr_library(void*)':
aspr.cpp:(.text+0x493): referencia a `dlclose' sin definir
collect2: error: ld returned 1 exit status