Linking tesseract and opencv in Visual Studio 2013 on x64 bit machine - visual-studio

I'm trying to run a program based on tesseract and opencv on Visual Studio 2013. I have a x64 bit machine and the problem is when I run it under Win32 I got only opencv linking errors, however under x64 I got tesseract linking errors.
Here are some errors screenshots :
Tesseract Errors :
error LNK2001: unresolved external symbol pixDestroy
error LNK2001: unresolved external symbol pixReadTesseract
error LNK1120: 7 unresolved externals
Opencv Errors :
error LNK2001: unresolved external symbol _cvLoadImage
error LNK2001: unresolved external symbol _cvCreateImage
error LNK2001: unresolved external symbol _cvSaveImage
error LNK2001: unresolved external symbol _cvReleaseImage
error LNK1120: 4 unresolved externals
Thank you guys :-)

Your problem appears to be that you have 32bit build of Tesseract and 64bit build of OpenCV, and trying to use them both in the same program. That will not work -- you either need all 64bit libraries for a 64bit application, or all 32bit libraries for a 32bit application.
If you want to stick with OpenCV 3.1 (since the standard distribution package doesn't seem to contain 32bit binaries), then you have to go and build one of the libraries yourself. The older versions still had them.
Another option is to download this nuget package along with the associated redistributables package. Since the files are just ZIP files with a different extension, it is possible to extract all the headers, import libraries and DLLs manually.

Related

Visual Studio 2019: LNK2019: unresolved external symbol error in Release mode

I have a visual studio solution with 3 projects. 2 are DLL. The DLL library from one project is linked to the other via linker. The program runs in Debug mode. But in release mode, it shows LNK2019: unresolved external symbol error. This means the linking is not functioning properly. I rechecked the linker input files and the project dependencies if done properly.

Unresolved external symbol with zlib and libpng. Visual studio 2013

As I need to link to static C runtimes I decided to build all as static librarys in question with the same version of Visual Studio (2013) using the same Platform Toolset and Runtime libraries Multi-Threaded /MT
I am trying to get my application to link to a 3rd party game engine. This engine is built on top of libpng and zlib. libpng is also built on top of zlib.
So I build zlib from scratch into a static library.
I then build libpng and point it to the zlib as an additional dependency so zlib gets linked in to my libpng static library.
I then build my game engine linking to both libpng and zlib as additional dependencies. The linker removes the second zlib definition. So far all builds fine.
I then link my application just to my game engine static library. I get linker errors like:
2>libOxygine-vc120-mt-gd.lib(unzip.obj) : error LNK2001: unresolved external symbol _inflate
2>libOxygine-vc120-mt-gd.lib(pngrutil.obj) : error LNK2001: unresolved external symbol _inflate
2>libOxygine-vc120-mt-gd.lib(unzip.obj) : error LNK2001: unresolved external symbol _inflateEnd
2>libOxygine-vc120-mt-gd.lib(pngread.obj) : error LNK2001: unresolved external symbol _inflateEnd
2>libOxygine-vc120-mt-gd.lib(unzip.obj) : error LNK2001: unresolved external symbol _crc32
2>libOxygine-vc120-mt-gd.lib(png.obj) : error LNK2001: unresolved external symbol _crc32
2>libOxygine-vc120-mt-gd.lib(unzip.obj) : error LNK2001: unresolved external symbol _inflateInit2_
2>libOxygine-vc120-mt-gd.lib(png.obj) : error LNK2001: unresolved external symbol _adler32
2>libOxygine-vc120-mt-gd.lib(png.obj) : error LNK2001: unresolved external symbol _inflateReset
2>libOxygine-vc120-mt-gd.lib(pngrutil.obj) : error LNK2001: unresolved external symbol _inflateInit_
2>libOxygine-vc120-mt-gd.lib(pngwrite.obj) : error LNK2001: unresolved external symbol _deflateEnd
2>libOxygine-vc120-mt-gd.lib(pngwutil.obj) : error LNK2001: unresolved external symbol _deflateReset
2>libOxygine-vc120-mt-gd.lib(pngwutil.obj) : error LNK2001: unresolved external symbol _deflateInit2_
2>libOxygine-vc120-mt-gd.lib(pngwutil.obj) : error LNK2001: unresolved external symbol _deflate
It seems to be having a problem finding zlib but this has been linked into libpng, which in turn was linked into the game library libOxygine.
My application itself is not directly dependant on both zlib and libpng so I dont really want to have to link to them directly from my application as it should be all taken care of inside my game engine library libOxygine.
Thanks
If you used .vcxproj project from zlib package, it contains some bugs.
here is instruction for fixing them (i used zlibvc, not zlibstat):
http://www.tannerhelland.com/5076/compile-zlib-winapi-wapi-stdcall/
For fixing the unresolved symbols problem, open zlib project preferences,
then go to Configuration Properties -> C/C++ -> Preprocessor, and in the Preprocessor Definitions line remove “ZLIB_WINAPI;” (don’t forget to remove the trailing semicolon).
libpng depends upon zlib, so you must link libpng first, then zlib. From your error messages it appears that you have them reversed. For example, if you are using gcc to build and link, you need "-lpng -lz" on the commandline, not "-lz ... -lpng".

Using zlib in Visual C++ project

I've been struggling to compile my Visual C++ 2010 project with dependency of Zlib. I've got source code that worked on Linux and Mac OS X. Here's, where I have linker errors:
error LNK2019: unresolved external symbol _inflate#8 referenced in function...
error LNK2019: unresolved external symbol _inflateInit2_#16 referenced in function...
error LNK2019: unresolved external symbol _deflate#8 referenced in function...
error LNK2019: unresolved external symbol _deflateInit2_#32 referenced in function...
I've been finding solution for few days now, trying compiling Zlib different ways, but it is clear that I've missed something. Very similar question has been answered here, but not clearly enough for amateur like me. I would need step-by-step guide how to get it to work.
Thank you in advance.
If you have static libraries after building the Zlib, point them in your project at this location.Project properties -> Linker -> Input -> Additional dependencies. Give the absolute path.

Linking issue with boost mpi in Visual Studio

I'm using Visual Studio 2010 and I've installed openmpi and boost. I've successfully managed to build the boost mpi libraries but when I try to run their example hello_world program I get linking errors like:
Error 16 error LNK2001: unresolved external symbol "public: void __cdecl boost::mpi::communicator::send(int,int,class boost::mpi::packed_oarchive const &)const " (??$send#Vpacked_oarchive#mpi#boost###communicator#mpi#boost##QEBAXHHAEBVpacked_oarchive#12##Z) C:\Dropbox\mpi_tess\MPITess\hello_world.obj
I've included the build lib files into the linker path. Any ideas what's wrong?
Thanks for the help,
Elad

CUDA: Getting linking error only in device emulation mode

I am compiling a dll which goes just fine unless I use the -deviceemu mode.
In this case I get several of the following linking errors:
CUDAKernel_ColourHist.obj : error LNK2019: unresolved external symbol
___cudaMutexOperation#4 referenced in function ___uAtomicAdd
1>CUDAKernel_1.obj : error LNK2001:
unresolved external symbol
___cudaMutexOperation#4 1>CUDAKernel_2.obj : error LNK2001:
unresolved external symbol
___cudaMutexOperation#4
Which led me to believe perhaps I wasn't linking the correct files, but I believe I am. I am using Visual Studio and any help woud be appreciated.
Fixed, I was using an older version of the libraries, linking with the newer libraries fixed the problem.

Resources