LNK1112 in building from scratch of opencv - visual-studio

Here is my goal: being able to have the opencv library in x86 (32bits) using VisualStudio
Here is my problem: by following this tutorial http://dogfeatherdesign.com/opencv-3-0-microsoft-visual-studio-2015-cmake-and-c/
or this one http://amin-ahmadi.com/2015/12/04/how-to-build-opencv-from-source-for-vc14/
even with this version http://amin-ahmadi.com/2015/12/22/how-to-build-opencv-310-msvc2010-vc10-x86/ (which take care of the fact that new versions of OpenCV don't have precompiled libraries for the x86) I had to build it from scratch.
And in each case, after having successfully generated a VS file from opencv, the compiler (after 5minutes of compilation) tells me the following error: "LNK112 module machine type x64 conflicts with target machine type x86".
Nevertheless, I didn't compile either with the x64 or x86 solution platform, but only Win32. Hope to have given enough details, thank for the help! :)

I actually fond the answer: after having installed python 64 bits, cmake linked this library automatically, which was the cause of the error. Since I didn't need opencv for python I just reconfigured the project with cmake, generated it, and it worked with no error.

Related

Compile OpenCV 3.4 and Cuda 9.2 with MS VS15 2017

I need to do fast image processing so I decide to go for OpenCV with CUDA support. Now I'm trying to build OpenCV as dll to use it in my project, but I am not even able to generate the VS project since CMake keeps giving me this error:
CMakeError. I am on Windows 10, CMake 3.11 with VS 15 2017 x64 generator, OpenCV 3.4 (the last release).
I have installed CUDA 9.2, 9.1 and 8.0 and set CUDA_HOME environment variable as the CUDA toolkit directory. Nothing seems to work.
Then I try to set the CUDA_SDK_ROOT_DIR through the CMake GUI, but the CUDA toolkit directory seems to be not the right one and I'm not able to find the CUDA sample directory anywhere.
I have googled a lot, but I found nothing that had been able to help me. Did someone face this very same issue? How can I solve it?
PS: I have successfully created the dll with TBB and IPP (without CUDA) and it is still not fast enough, so I really need to use Cuda.
I have solved using Cuda 9.1 and VS 15.45. To install CUDA in a correct way you need to use custom installation and delete the VS integration, since it seems to have some problems. Once installation is complete, CMake should detect it.
This is a guide that could help.

Setting up QtCreator cross compiler for ARM on Windows

I need to develop Qt and command line software for the BeagleBone Black and Raspberry Pi-2. Ideally I wish to use QtCreator as I am accustomed to it, but in any case I need to use QtDesigner for GUI work.
I have spent days trawling through articles, going around in circles and getting nowhere.
The Raspberry Pi-2 has Raspbian/Jessie installed together with Qt 5.2.3. I can design, compile and run Qt desktop applications on this. Of course compilation is slow and not really usable for development work.
To try and keep matters simple, I downloaded qt-opensource-windows-x86-android-5.3.2.exe and installed that on my Windows 7 (64-bit) system. My belief is that this Qt install is the same version as the Qt on the Pi-2 and already contains the ARM7 library files required for cross-compiling. All that should be needed is a cross-compiler for Windows/ARM?
Windows/QtCreator complained in Tools > Options > Qt Versions about the Qt 5.3 for Android armv7 stating "No compiler can produce code for this Qt version...".
For a Windows/ARM cross-compiler I downloaded and installed Yagarto (yagarto-bu-2.23.1_gcc-4.7.2-c-c++_nl-1.20.0_gdb-7.5.1_eabi_20121222.exe). I figured I then just need to set the QtCreator compiler path in Tools > Options > Compilers and then things would start working. This is not the case.
Clearly I am missing something important and have managed to become confused by the number of not-quite-relevant articles I have read.
Is Yagarto the cross-compiler I need in this situation?
How do I define the compiler in QtCreator and get rid of the error?
Is there an easier way to set-up this stuff?
Thank you.
Details:
QtCreator 3.2.1 (Qt 5.3.2)
Windows 7 64-bit service pack 1
Edit:
I have just tried again using the GCC ARM Embedded ToolChain and GNU Make for Windows. The result is the same in that I cannot seem to configure the settings for QtCreator ARM7 and make it happy.

Compile Qt 5.2 application with the compiler MSVC2008

I have developed an application using Qt 5.2 which has be to be compiled in Visual studio 2008. But i found on the following link that the oldest MSVC compiler that can be used with Qt5 is MSVC2010.
Link
Is it possible to compile Qt 5.2 application with MSVC 2008 ?
Thank you for any pointers.
You will need one of three solutions:
1) Drop MS2008 and use a modern compiler
2) Use an older Qt that supports VS2008 (some Qt4 version)
3) Compile Qt5 with old compiler and hope the best
I would try to do 1) even if it means some effort. You should always try to stay up to date (and the longer you wait the more difficult it gets). If this isn't possible I would probably try 2) since it gives you an oudated but at least stable Qt. 3) is the worst solution at my opionion since anything could happen... without good chances to cleanly solve appearing compatibility issues.
As the http://download.qt-project.org/official_releases/qt/5.2/5.2.1/ (but also your link) shows there is no official package for Qt 5.2 with MSVC2008. However, this does not mean you should not try to compile it.
Just download the source from http://download.qt-project.org/official_releases/qt/5.2/5.2.1/single/ and try to compile it. I see in the mkspec directory an entry for win32-msvc2008 so in theory it should work, however I cannot guarantee that it will compile flawlessly.
But I am very curious how did you manage to
developed an application using Qt 5.2 which has be to be compiled in Visual studio 2008
Maybe you should upgrade your compiler to get the full benefits that come with it.

dll dependency issue in windows with msvc runtime

I am trying to run a program that depends on Matlab 2010 binaries. Those depend on msvc80 dlls.
It worked fine a couple of days ago. Then I installed a new version of Matlab, and all hell broke loose. Note that I am still trying to run the same program depending on the same Matlab binaries.
I have :
Installed and uninstalled the latest msvc 2005 redistributable package.
Removed all occurence of Matlab 2014 from my path.
When I run dependency walker, it finds MSVCR80.DLL, but not always, I wonder if it is looking for another version?
http://imgur.com/jj2mUAV
I have tried copying the version it finds in the winsxs folder, but it leads to a runtime error saying I am trying to load the C runtime library the wrong way...
Where should I go now?

dll Dependency unwanted with visual studio 2010

I am using visual studio 2010.
Before starting my project, I installed cuda SDK 4.2.
After that, I installed opencv 2.4.2. In my project, I'm using only opencv and it works correctly. However, when I try to run my program on another computer it tells me that cuda dll (like cudart32_42_9.dll, npp32_42_9.dll and nvcuda.dll) are needed. I don't use at all cuda and do no reference in my project property to cuda. I would like to know how to remove those dependency. I don't understand why visual studio add dll I don't use.
The pre-built OpenCV 2.2 onwards, comes with 2 versions of the binaries (dlls).
The dlls in the \build\gpu directory are the superset and are built with CUDA support. Therefore, to use them you require the CUDA Runtime dlls (cudart, npp etc). These binaries are required if you want to use the GPU functionality of OpenCV. These may also be used to check if you have a GPU present in your system or not.
The other version of dlls which are present in the x86 or x64 folder in the build directory of OpenCV, are built without CUDA support (although a gpu dll is also present in that directory). You don't need cuda dlls to use these binaries.
Both of these versions are built with Intel Thread Building Blocks support, and so require tbb_debug.dll and tbb.dll for Debug and Release configurations respectively. So if you use the CPU functions of OpenCV, they will be TBB Accelerated.

Resources