Install OpenCV without lib file - c++

I have a version of OpenCV built with MinGW and I'm trying to include it in a Visual Studio project. I have the dlls and the header files, however no lib files were provided. Only dll.a files. I tried pointing the linker additional dependencies setting to the dll.a files however I still get unresolved external symbol errors.
How do I use this version of OpenCV if it doesn't have the lib files?
Note: I should mention, I'm trying to use this specific build because it is x86, which is what I need for this project, and the official site doesn't seem to provide x86 builds.

Related

C++ detours linking issue

I have problems building my code that is using static lib detours. I am trying to do an old basic CTF. For that I want to get into detours.
Whenever I try to build my .dll file I get an issue
LNK2019 unresolved external symbol _DetourTransactionBegin#0 referenced in function _DllMain#12
Now, I have built the detours library using 3 different version of the visual studio dev console.
I have tried firing 'vcvars32.bat' and then using nmake to build the library which was able to build it, but I get the above error during linking my .dll. I have also tried building it with 'vcvarsamd64_x86.bat' and then using nmake to build it which also was able to build the library, but I still get the same error as above during linking.
I have tried the usual stuff: the include folder for detours.h is added to C++/General/Additional Include Directories.
Under Linker/Additional Library Directories I added them as follows: "C:\temp\det_retry\lib.X64";"C:\temp\det_retry\lib.X86";%(AdditionalLibraryDirectories).
And also under Linker/Input/Additional Dependencies I have the following: detours.lib;%(AdditionalDependencies)
What am I missing here? This is a blocker for me for a couple of days and I am reiterating the same steps trying to figure out what's missing but I cannot see. I'd really appreciate the input.
I am sure I am using the newest version because I have downloaded (cloned) detours from the ms github page.
It appears your "Additional Library Directories" are setup incorrectly or contain invalid entries rather. They look like actual library file entries (i.e. pointing to some specific files) versus being only directories (e.g. "my/lib/path/for/my_project/"). Visual Studio's naming conventions are somewhat cryptic but they should be directory entries only. There should be an entry to whatever directory contains the detours.lib file (e.g. "MyProject/Libs/MSDetour" ... where MSDetour is a folder with the "detours.lib" in it) and then Visual Studio should find the library and link everything correctly.
As a side note, if you are using the Visual Studio developer console for building your project/solution you might want to look into CMake ... it is, in my opinion, significantly easier to work with (less "settings" digging) and maintain in the long-run.

OpenCV and Visual Studio 2015: Why is including the static library not working?

I'm trying to set up a VS2015 solution I have with OpenCV 3.0.0, and I'm trying to do so using static libraries only.
Header files: the OpenCV header files are included correctly and I can reference them in my source files without issue.
Libraries: the static library file that was created for me when I used CMake to build OpenCV (called "ippicvmt.lib") is included correctly, and loads without issue.
Using OpenCV in code: when I try to use OpenCV classes/functions in my solution, I get linker errors when building similar to
LNK2001: unresolved external symbol "public: virtual double __thiscall cv::VideoCapture::get(int)const
I can right-click and choose "Go to definition" on my use of this function and it opens videoio.hpp and shows the declaration of the virtual method. The linker error I see is likely caused by the inability for visual studio to find the actual implementation of the method in the static library I have included in my solution.
It is my understanding that the only .lib file I need to include is the one static library file. That is all I have included right now.
Does anybody know why VS can't find the implementations of this code in the OpenCV static library?
I fixed my issue by disabling the flag for building with shared libs in CMake, after that way more .lib files show up in the sharedlib folder in my install. I added each .lib file I wanted to use to my additional dependencies in my project properties and my project built.

Linking a DLLs in visual studio 2013

I've already looked for solution, without a success.
I need to use a DLL supplied by third parties on Visual Studio 2013(running on (x64) Windows 10).
On machine there are both OpenCV 3.0.0 and OpenCV2.410 installed and working.
The DLL's author has provided a .lib file and He says that in order to use this DLLs in your project, you need to put some others OpenCV's dlls in the project folder( I've tried to put these DLLs in every project folder[yes I know, it has no sense, but after a lot of tries i've lost my patience])
What he supplies is an .dll and an example project( that doesn't work for me because it needs OpenCV2.1 and there are instructions needs to be translate in newest version [and I prefered don't translate nothing]).
The errors in this example project are of this kind:
error LNK2001: unresolved external symbol
fatal error LNK1120: unresolved externals
The most of them are caused by the miss of OpenCV2.1, that I don't want to install, because I'll have to use it on a program using with OpenCV 3.0.0.
In the example project folder there are:
The upper mentioned .dll
A .lib file
The header file .h
These DLLs: cv210.dll, cxcore210.dll, highgui210.dll, ...(eg. cv210d.dll)
What I've done is this:
A folder called "lib" where I insert all .dll, .lib, .h files.
Put the "lib" folder in Project properties>linker> General> Additional Library Directories
Writing the .lib file in properties>linker> Input> Additional Dependencies
Put the 'lib' pathproperties>C/C++>Additional Include Directories[I know, this has no sense too]
I get these kind of errors:
error LNK2001: unresolved external symbol
I've tried #pragma comment(lib, 'file.lib') way too.
Someone can help me?

Linking error while using dlib with libjpeg

I am studying Machine Learning and Pattern Recognition and using dlib library for that. I was trying one example code face_detection_ex.cpp provided with the library. I created a separate project under Visual Studio 2010 and included the face_detection_ex.cpp example and dlib\all\source.cpp files. It build fine. But, if I enable DLIB_JPEG_SUPPORT by
#define DLIB_JPEG_SUPPORT
then it will throw the linking error LNK2019 for all the functions of libjpeg library used by the dlib library. I tried #pragma comment(lib, libjpeg) and I also tried to include the library in project properties, but still the same.
After spending 1 day on this error, I switched to linux and try to work in that. But there also I am getting the same linking errors.
Then on the dlib release-note I read that libjpeg library is included in dlib's external folder and use dlib's cmake file for the example code and cmake will perform the static linking. I tried that and with cmake it is linking. I tried to find out how the linking is happening as I want it to work with visual studio and other compilers also but I couldn't find out why the libjpeg library is unable to link.
Any suggestion?
EDIT: Here it is mentioned how to use dlib with Visual Studio. And how to compile the example on linux. So, as I have to link with libjpeg library, I added the -ljpeg in the command.
You can use CMake to generate a Visual Studio project that is properly configured and that's the easiest way to do this if you want to use Visual Studio.
However, if you really want to configure the Visual Studio project by hand then all you need to do is add the files in the dlib/external/libjpeg folder to your Visual Studio project and also add the dlib/external/libjpeg folder to the include search path.

ImageMagick static compilation with another project gives linker errors

I've downloaded the ImageMagick source, compiled the wizard to create a Visual Studio solution for static linkage, and included the static library Magick++ project in my sample project (code below). I've also added a dependency on that project and included the .lib file in the solution, nothing helps.
#include <Magick++.h>
int main()
{
Magick::Image image;
bool test = image.isValid();
return 0;
}
This gives several linker errors, such as:
unresolved external symbol "__declspec(dllimport) public: virtual __thiscall Magick::Image::~Image(void)" (__imp_??1Image#Magick##UAE#XZ) referenced in function _main
Why can't it find the implementation?
I'm using Visual Studio 2010 Beta 2.
The problem may rise from that you are using different compiler than the library was compiled with. As your compiler is fairly new, it's very likely it uses different name mangling and can't find method signatures inside the library.
The answer to linking the ImageMagick static libraries is to ensure you link ALL the dependant static libraries as well!
Once you have compiled the solution for ImageMagick static libraries, go to the 'VisualMagick' folder (within the ImageMagick cloned repository) then to to the 'lib' folder there you will see all the _DB_.lib and _RL_.lib files for Debug and Release.
You need to include those names in the 'Additional Dependencies' section for both Release and Debug.
You must also ensure you have the Library folder path in the 'Additional Library Directories' for both Release and Debug.
Another key aspect is to ensure the libraries are built by the same compiler for the same platform architecture as your own application .. (WIN32 or x64).
This error is strange - The compiler is looking for a function from a DLL (__declspec(dllimport)). Are you sure you are using the right header files ?