Tesseract Api Linker Error with Using Opencv - c++

I am using tesseract api and my project(I am using vs2013c++) has just tesseract api I have no porblem On the other hand I am using opencv nd my project has just opencv I have no problem But I want to use together them I have LINK error but I m sure that I added libraries correctly()
Those are the error messages:
error LNK1120: 2 unresolved externals
error LNK2019: unresolved external symbol "public: __cdecl tesseract::TessBaseAPI::TessBaseAPI(void)" (??0TessBaseAPI#tesseract##QEAA#XZ) referenced in function main
error LNK2019: unresolved external symbol "public: virtual __cdecl tesseract::TessBaseAPI::~TessBaseAPI(void)" (??1TessBaseAPI#tesseract##UEAA#XZ) referenced in function main

Related

compiling libcurl 7.61.1 from source on Windows 10

I'm working on an existing C++ project. We include libcurl as a static library, which we build from source. I'm trying to upgrade us from version 7.38.0 to version 7.61.1.
I downloaded curl-7.61.1.zip from here: https://curl.haxx.se/download/.
I made no modifications to the source and did not run any scripts that came with curl 7.61.1.
We have an existing VS solution we used for compiling curl 7.38.0, so I started from that and modified as needed for the new files in curl 7.61.1.
Everything compiled fine, however, when I try to link the compiled result into my project, I get the following errors:
1>libcurl.lib(schannel.obj) : error LNK2019: unresolved external symbol __imp_CertOpenStore referenced in function schannel_connect_step1
1>libcurl.lib(schannel_verify.obj) : error LNK2001: unresolved external symbol __imp_CertOpenStore
1>libcurl.lib(schannel.obj) : error LNK2019: unresolved external symbol __imp_CertCloseStore referenced in function schannel_connect_step1
1>libcurl.lib(schannel_verify.obj) : error LNK2001: unresolved external symbol __imp_CertCloseStore
1>libcurl.lib(schannel.obj) : error LNK2019: unresolved external symbol __imp_CertFindCertificateInStore referenced in function schannel_connect_step1
1>libcurl.lib(schannel.obj) : error LNK2019: unresolved external symbol __imp_CertFreeCertificateContext referenced in function pkp_pin_peer_pubkey
1>libcurl.lib(schannel_verify.obj) : error LNK2001: unresolved external symbol __imp_CertFreeCertificateContext
1>libcurl.lib(schannel.obj) : error LNK2019: unresolved external symbol __imp_CryptStringToBinaryA referenced in function schannel_connect_step1
1>libcurl.lib(schannel_verify.obj) : error LNK2019: unresolved external symbol __imp_CertAddCertificateContextToStore referenced in function add_certs_to_store
1>libcurl.lib(schannel_verify.obj) : error LNK2019: unresolved external symbol __imp_CertGetNameStringA referenced in function verify_host
1>libcurl.lib(schannel_verify.obj) : error LNK2019: unresolved external symbol __imp_CryptQueryObject referenced in function add_certs_to_store
1>libcurl.lib(schannel_verify.obj) : error LNK2019: unresolved external symbol __imp_CertCreateCertificateChainEngine referenced in function verify_certificate
1>libcurl.lib(schannel_verify.obj) : error LNK2019: unresolved external symbol __imp_CertFreeCertificateChainEngine referenced in function verify_certificate
1>libcurl.lib(schannel_verify.obj) : error LNK2019: unresolved external symbol __imp_CertGetCertificateChain referenced in function verify_certificate
1>libcurl.lib(schannel_verify.obj) : error LNK2019: unresolved external symbol __imp_CertFreeCertificateChain referenced in function verify_certificate
1>C:\Users\CoffeeTableEspresso\project\win64-vs15\debug-mt\executable.exe : fatal error LNK1120: 12 unresolved externals
Has anyone run into similar issues before? Please let me know if I need to edit this with more info as well.
As Peter mentioned in a comment, I needed to link against windows libraries. In this case, linking against crypt32.lib solved the issue for me.

Why won't OpenSSL link properly on Windows

I'm using OpenSSL 1.1.0d for a Managed C++ project built with Visual Studio 2013. Building for Debug works great, but building for Release generates these linker errors:
error LNK2019: unresolved external symbol _SSLv23_server_method
error LNK2019: unresolved external symbol _SSLv23_client_method
error LNK2019: unresolved external symbol _CRYPTO_num_locks
error LNK2019: unresolved external symbol _CRYPTO_set_locking_callback
error LNK2019: unresolved external symbol _CRYPTO_set_dynlock_create_callback
error LNK2019: unresolved external symbol _CRYPTO_set_dynlock_lock_callback
error LNK2019: unresolved external symbol _CRYPTO_set_dynlock_destroy_callback
error LNK2019: unresolved external symbol _OPENSSL_add_all_algorithms_noconf
error LNK2019: unresolved external symbol _EVP_cleanup
error LNK2019: unresolved external symbol _SSL_load_error_strings
error LNK2019: unresolved external symbol _SSL_library_init
error LNK2019: unresolved external symbol _ERR_free_strings
error LNK2019: unresolved external symbol _CONF_modules_free
error LNK2019: unresolved external symbol _sk_num
error LNK2019: unresolved external symbol _sk_value
I've tried using my own build of OpenSSL as well as a pre-compiled version from sigmoid, and results are the same.
My hypothesis is that while these OpenSSL builds are with '/MD', that alone isn't enough to be compatible with my Managed C++ project. Since there are no direct calls from the Managed layer into OpenSLL, however, my understanding is that building with '/MD' should suffice. Plus, the Debug version works just fine. So why does just the Release one choke?
What is causing these linker errors, and how do I resolve them?
You're probably using the wrong OpenSSL version. Try OpenSSL v1.0.2k. The symbols it is complaining about are not included in the 1.1.x branch.
Remember to also link in ws_lib32.lib and crypt32.lib if necessary.

Compile FFmpeg Zeranoe Build with Visual Studio 2013

I downloaded the most recent Zeranoe dev build here, included the header files to my code, placed extern "C" around the includes, since this is a C++ project and FFmpeg is a C library, and added the libs to Visual Studio as well, and I get this linker error:
1>Camera.obj : error LNK2019: unresolved external symbol _av_free referenced in function __catch$?NewFrameReceived#Camera#MicroDFV_Camera##AAEXKKKGPAE#Z$0
1>Camera.obj : error LNK2019: unresolved external symbol _av_freep referenced in function __catch$?NewFrameReceived#Camera#MicroDFV_Camera##AAEXKKKGPAE#Z$0
1>Camera.obj : error LNK2019: unresolved external symbol _av_frame_alloc referenced in function __catch$?NewFrameReceived#Camera#MicroDFV_Camera##AAEXKKKGPAE#Z$0
1>Camera.obj : error LNK2019: unresolved external symbol _av_frame_free referenced in function __catch$?NewFrameReceived#Camera#MicroDFV_Camera##AAEXKKKGPAE#Z$0
1>Camera.obj : error LNK2019: unresolved external symbol _avcodec_register_all referenced in function __catch$??0Camera#MicroDFV_Camera##QAE#V?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##0PAX#Z$0
1>Camera.obj : error LNK2019: unresolved external symbol _avcodec_alloc_context3 referenced in function __catch$?NewFrameReceived#Camera#MicroDFV_Camera##AAEXKKKGPAE#Z$0
1>Camera.obj : error LNK2019: unresolved external symbol _avcodec_open2 referenced in function __catch$?NewFrameReceived#Camera#MicroDFV_Camera##AAEXKKKGPAE#Z$0
1>Camera.obj : error LNK2019: unresolved external symbol _avcodec_close referenced in function __catch$?NewFrameReceived#Camera#MicroDFV_Camera##AAEXKKKGPAE#Z$0
1>Camera.obj : error LNK2019: unresolved external symbol _av_init_packet referenced in function __catch$?NewFrameReceived#Camera#MicroDFV_Camera##AAEXKKKGPAE#Z$0
1>Camera.obj : error LNK2019: unresolved external symbol _av_packet_unref referenced in function __catch$?NewFrameReceived#Camera#MicroDFV_Camera##AAEXKKKGPAE#Z$0
1>Camera.obj : error LNK2019: unresolved external symbol _avcodec_find_encoder referenced in function __catch$?NewFrameReceived#Camera#MicroDFV_Camera##AAEXKKKGPAE#Z$0
1>Camera.obj : error LNK2019: unresolved external symbol _avcodec_encode_video2 referenced in function __catch$?NewFrameReceived#Camera#MicroDFV_Camera##AAEXKKKGPAE#Z$0
1>Camera.obj : error LNK2019: unresolved external symbol _av_opt_set referenced in function __catch$?NewFrameReceived#Camera#MicroDFV_Camera##AAEXKKKGPAE#Z$0
1>Camera.obj : error LNK2019: unresolved external symbol _av_image_alloc referenced in function __catch$?NewFrameReceived#Camera#MicroDFV_Camera##AAEXKKKGPAE#Z$0
1>M:\Desktop\OpenCVTest\Debug\OpenCVTest.exe : fatal error LNK1120: 14 unresolved externals
Searching here and on Google I found many recommendations, such as to add #pragma comment(lib,...), and that the libs are static, so their order is important, and none of this helps.
So I scratched my head even more and realized that the Zeranoe build is made with MinGW-w64, so probably it won't link with Visual Studio. I inspected the lib using dumpbin and the symbols on the libs don't have the underscore, so I am pretty sure it won't work.
The other Zeranoe builds for Windows don't have libs, they are just plain .exe or exe + .dll.
Will I have to make my own VS2013 build of FFmpeg to link it, or is there some alternative way?

linker problems for EasyHook in Visual C++ 10

I have downloaded EasyHook 2.7 source and I try to compile it in my Visual Studio 2012 environment.
After solving a lot of warnings, I have found other warnings that I cannot solve, and these are:
1>error.obj : error LNK2019: unresolved external symbol _CoTaskMemAlloc#4 referenced in function _RtlGetLastErrorStringCopy#0
1>error.obj : error LNK2019: unresolved external symbol _CopyMemory#12 referenced in function _RtlGetLastErrorStringCopy#0
1>reloc.obj : error LNK2019: unresolved external symbol _ud_init#4 referenced in function _LhDisassembleInstruction#20
1>reloc.obj : error LNK2019: unresolved external symbol _ud_set_mode#8 referenced in function _LhDisassembleInstruction#20
1>reloc.obj : error LNK2019: unresolved external symbol _ud_set_input_buffer#12 referenced in function _LhDisassembleInstruction#20
1>reloc.obj : error LNK2019: unresolved external symbol _ud_set_syntax#8 referenced in function _LhDisassembleInstruction#20
1>reloc.obj : error LNK2019: unresolved external symbol _ud_disassemble#4 referenced in function _LhDisassembleInstruction#20
1>reloc.obj : error LNK2019: unresolved external symbol _ud_translate_intel#4 referenced in function _LhDisassembleInstruction#20
1>reloc.obj : error LNK2019: unresolved external symbol _ud_set_asm_buffer#12 referenced in function _LhDisassembleInstruction#20
1>C:\Users\Jaime Stuardo\Downloads\EasyHook-2.7.5159.0-Source\\Debug\x86\EasyHook32Drv.sys : fatal error LNK1120: 9 unresolved externals
What lib files I need to add so that the linker will not fail? notice that the first 2 functions belong to Windows API, so it is very curious it does not link.
Regards
Jaime
For the Windows functions, just look them up on MSDN. CoTaskMemAlloc says you need to link OLE32.LIB. CopyMemory says KERNEL32.LIB. The functions beginning with ud come from a library which Easyhook depends on: "EasyHook makes use of the udis86 library by Vivek.

Setting up OpenGL - it won't work

I just bought a new laptop with windows 8 64bit and I am using Visual Studio 2012.
I did the usual procedure with installing a 3d party lib just as I installed them on my previous PCs:
Download freeglut, glew, glfw, glut, sdl
Copy headers into "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include"
Copy libs into "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\lib"
Copy dll's into "C:\Windows\SysWOW64"
Then I downloaded the project I was developing on my other PC (was developed under windows 8 32bit if that's of any importance) and it would'n compile. The compiler threw me the following linking error:
Error 1 error LNK2001: unresolved external symbol __imp__glDrawArrays#12 - about 50 of these
Error 63 error LNK2019: unresolved external symbol __imp__glClear#4 - again about 50 of these
The project is working perfectly on my old PC.
I did try to make a simple new project: http://pastebin.com/GfEieL6f
Linked the following libraries (Properties->Linker->Input->Additional Dependencies)
opengl32.lib
glut32.lib
glu32.lib
And again it wouldn't compile, again the same linking errors:
Error 1 error LNK2019: unresolved external symbol __imp__glBegin#4 referenced in function "void __cdecl drawcube(void)" (?drawcube##YAXXZ) P:\OpenGL_Setup\OpenGL_Setup\opengl_setup.obj
Error 2 error LNK2019: unresolved external symbol __imp__glClear#4 referenced in function "void __cdecl drawcube(void)" (?drawcube##YAXXZ) P:\OpenGL_Setup\OpenGL_Setup\opengl_setup.obj
Error 3 error LNK2019: unresolved external symbol __imp__glClearColor#16 referenced in function _main P:\OpenGL_Setup\OpenGL_Setup\opengl_setup.obj
Error 4 error LNK2019: unresolved external symbol __imp__glColor3f#12 referenced in function "void __cdecl drawcube(void)" (?drawcube##YAXXZ) P:\OpenGL_Setup\OpenGL_Setup\opengl_setup.obj
Error 5 error LNK2019: unresolved external symbol __imp__glEnd#0 referenced in function "void __cdecl drawcube(void)" (?drawcube##YAXXZ) P:\OpenGL_Setup\OpenGL_Setup\opengl_setup.obj
Error 6 error LNK2019: unresolved external symbol __imp__glFlush#0 referenced in function "void __cdecl drawcube(void)" (?drawcube##YAXXZ) P:\OpenGL_Setup\OpenGL_Setup\opengl_setup.obj
Error 7 error LNK2019: unresolved external symbol __imp__glLoadIdentity#0 referenced in function _main P:\OpenGL_Setup\OpenGL_Setup\opengl_setup.obj
Error 8 error LNK2019: unresolved external symbol __imp__glMatrixMode#4 referenced in function "void __cdecl drawcube(void)" (?drawcube##YAXXZ) P:\OpenGL_Setup\OpenGL_Setup\opengl_setup.obj
Error 9 error LNK2019: unresolved external symbol __imp__glOrtho#48 referenced in function _main P:\OpenGL_Setup\OpenGL_Setup\opengl_setup.obj
Error 10 error LNK2019: unresolved external symbol __imp__glRotatef#16 referenced in function "void __cdecl drawcube(void)" (?drawcube##YAXXZ) P:\OpenGL_Setup\OpenGL_Setup\opengl_setup.obj
Error 11 error LNK2019: unresolved external symbol __imp__glVertex3iv#4 referenced in function "void __cdecl drawcube(void)" (?drawcube##YAXXZ) P:\OpenGL_Setup\OpenGL_Setup\opengl_setup.obj
I don't know if I am missing something, can you give me some ideas ?
PP: I managed to fix the simple program and run it, but I cannot run my old project. Maybe it's a problem because of the platform change ? How can I fix it?
Don't add files to the compiler lib directory. Instead add another library search path to your project.
You probably downloaded library files that aren't compatible with VC++ 2012 and your project build settings. In native code, you can't mix x86, x64, etc. Static libraries need to match your project bitness, not your OS. And Microsoft also changes/extends the library file format, as well as runtime library components used by the library, so you really should get a library file designed for your version of VC++.