OpenCV with Visual Studio 2015 Enterprise - c++

Hello Im trying to use OpenCV 3.0 with Visual Studio 2015 Enterprise but for some reason it is not working, what am I doing wrong ?
First of all I have OpenCV extracted in C:\opencv\ with 7z archive
In Visual Studio Project -> TestProject Properties
Configuration -> All Configuration && Platform -> All Platform
Configuration Properties -> VC++ Directory -> Include Directories => C:\opencv\opencv\build\include
Configuration Properties -> VC++ Directory -> Library Directories => C:\opencv\opencv\build\x86\vc12\lib
Configuration Properties -> C/C++ -> General -> Additional Include Libraries => C:\opencv\opencv\build\include
Configuration Properties -> Linker -> General -> Additional Library Directories => C:\opencv\opencv\build\x86\vc12\bin
Configuration -> Debug && Platform -> All Platform
Configuration Properties -> Linker -> Input -> Additional Dependencies =>
opencv_ts300d.lib
opencv_world300d.lib
Configuration -> Release && Platform -> All Platform
Configuration Properties -> Linker -> Input -> Additional Dependencies =>
opencv_ts300.lib
opencv_world300.lib
Now when I run a sample code I get MSVCP120D.dll is missing and MSVCR120D.dll is missing and cannot open input file 'kernel32.lib' errors. Does anyone had the same problem or know a solution ?

MSVCP120D.dll
One option is install redistributable Packages for older Visual Studio. And include this libs directly in your app from ProgramFiles/MicrosoftSDK/Windows/version/libs. This path find simply during the instalation.
This is for Visual studio 2013 here Package Here
Better is recompile opencv with cmake and visual studio.
Build opencv with Visual Studio 2015 compiler from source first. This reduce a risk that older framework missing in your computer. You need vc14 directory as a source of your libs. Prebuild libs are only for VS 2012 and 2013, which is VC11 and VC12 libs folder under your opencv/build/x64 or x86.
Speps are simple.
Download CMAKE, install
Download source code of Opencv, extract
run Cmake and add directory of your source and target directory for your project.
Configure Cmake just choose right compiler VS2015 first. There is many options. Just try the default one first.
Run Cmake. Result is Visual Studio 2015 project like opencv.sln under target directory.
Open opencv.sln project
Build this project with Visual Studio 2015.
Result is VC14 directory with libs to include.
Check this picture by picture tutorial. Tutorial Here
Also you can use NUGET console Tutorial Nuget opencv

To fix "MSVCP120D.dll is missing and MSVCR120D.dll" please download them
and put here
C:\Windows\System32

Related

Unable to install and use gRPC C/C++ on windows 10 with VS2017

I know the question I am asking here seems a bit silly but it is still an open ended question and will definitely help a lot of folks.
Problem :- What could be the way to install and use gRPC C/C++ in Visual Studio 2017 and windows 10 64 bit.
The documentation says to use CMAKE but providing very less information on how to actually build gRPC.
If anyone could please guide me step by step how to install gRPC would be very helpful to me and others who are new to gRPC and trying to build it.
Thanks a lot in advance!
I recently had issues with this myself and would like to present my solution, although the question is a little old.
There is a working vcpkg package available, but its version is outdated. Therefore I build and installed gRPC on Windows from source using Visual Studio 2017. The official documentation gives some hints, but is pretty vague in the details. I will list all steps below, some are copied from said documentation:
Prerequisites
Visual Studio (2015 or above should do)
Git
CMake (make sure to add CMake to the system PATH during installation)
Get gRPC
Clone gRPC repository:
git clone -b RELEASE_TAG_HERE https://github.com/grpc/grpc
Replace RELEASE_TAG_HERE with the release tag of your choice, e.g. v1.42.0 is the latest right now.
Load its dependencies:
cd grpc
git submodule update --init
Build gRPC from source
Create a build directory and go to it:
mkdir .build
cd .build
Generate Visual Studio project structure with CMake:
for Visual Studio 2017:
cmake .. -G "Visual Studio 15 2017"
or for Visual Studio 2019:
cmake .. -G "Visual Studio 16 2019"
or for Visual Studio 2022:
cmake .. -G "Visual Studio 17 2022"
Specify a specific target platform with the -A option, e.g. Win32, x64,ARM or ARM64.
Open the newly created solution grpc.sln (can be found in the .build directory) in Visual Studio.
Select the desired "Solution Configuration" (Debug, Release, ...) in Visual Studio and build the solution.
Install gRPC
This was the hard part to figure out, although it is fairly easy.
Start Visual Studio with administrator privileges and load grpc.sln.
In the "Solution Explorer", search for the project INSTALL.
Build the INSTALL project.
gRPC is now installed to:
C:\Program Files (x86)\grpc
Add C:\Program Files (x86)\grpc\bin to your systems PATH.
Use gRPC in your project
Add gRPC header files:
Right click on project -> Properties -> Configuration Properties -> C/C++ -> General -> Additional Include Directories
Edit this property and add the gRPC include directory C:\Program Files (x86)\grpc\include.
Add gRPC library directory:
Right click on project -> Properties -> Configuration Properties -> Linker -> General -> Additional Library Directories
Edit this property and add the gRPC library directory C:\Program Files (x86)\grpc\lib\.
Add gRPC libraries:
Right click on project -> Properties -> Configuration Properties -> Linker -> Input -> Additional Dependencies
Edit this property and add all libraries from the gRPC library directory (C:\Program Files (x86)\grpc\lib\).
There will be errors when building the project! Apparently, some libraries are present in different versions. You have to choose one of the versions for each library. As of gRPC v1.42.0 (Release Build), these libraries are:
grpc.lib vs. grpc_unsecure.lib
grpc++.lib vs. grpc++_unsecure.lib
libprotobuf.lib vs. libprotobuf-lite.lib
libprotoc.lib seems to be included in libprotobuf.lib
zlib.lib vs. zlibstatic.lib
Another option is link the libraries with preprocessor directives #pragma comment(lib, LIBRARY_HERE) into your project. Thus, the unused version can be commented out.
Now, your project should build without errors. Make sure you use the same "Solution Configuration" (Debug, Release) as you used for the gRPC build.
I hope this rather detailed guide helps you guys!

Cannot compile new project targeting WinXP after installing VS2015 Update 3

Steps to reproduce:
1. install vs2015 u3 RC
2. create a new win32 project
3. set Platform toolset to "Visual Studio 2015 - Windows XP (v140_xp)"
You can find the setting here:
Project -> Configuration properties -> General
4. Build
fatal error C1083: Cannot open include file: 'ctype.h': No such file or directory
(without step 3, it will compile just fine)
This is a known problem with Visual Studio 2015 Update 3 RC.
Visual C++ project build fails when using the v140_xp PlatformToolset
Issue:
When using PlatformToolset v140_xp, UCRT is not added to the Include
and Library path.
Workaround:
In Visual Studio, go to the Solution Explorer.
Right click on the project, click on “Properties” Find and Select “VC++ Directories”
Append Includes Directory with “$(MSBuildProgramFiles32)\Windows
Kits\10\Include\10.0.10240.0\ucrt”
Append Library Directory with “$(MSBuildProgramFiles32)\Windows
Kits\10\lib\10.0.10240.0\ucrt\$(PlatformShortName)”
Click OK or Apply to Save.

Can't get libcurl to work on Visual Studio C++ 2010 Express

I am trying to follow this tutorial:
http://quantcorner.wordpress.com/2012/04/08/using-libcurl-with-visual-c-2010/
Now go to VC++ Directories > Library directories. Add the Debug
directory containing curllib_static.lib, curllib.dll and curllib.lib
(C:\Users\Édouard\Documents\Visual Studio 2010\LibCurl\lib\Debug).
I don't have a Debug directory. Where do I get it? Thanks

Is there a way to list library dependencies in Visual Studio?

I'm trying to build a C++ project with Boost and Cinder on Windows Server 2008 with MSBuild without success. I've build the same project on my Windows 7 machine under VS2013 and MSBuild, however on the server it is saying that it can't open a library by the name of "threadsafestatics.lib"
I've never heard of threadsafestatics.lib and my Google-foo hasn't brought me any luck finding anything about it online.
Is there a way to find out what part of my project is depending on this library?
Providing debug level output for the build process helped to work around the problem:
Tools->Options->Projects and Solutions->Build and Run->MSBuild project build output verbosity
threadsafestatics.lib is a new library from the November 2013 CTP. If you are compiling with the CTP, you must add its installed lib folder to Project > Properties > VC++ Directories > Library Directories.
If you installed the CTP to its default location on a 64-bit machine, the path is C:\Program Files (x86)\Microsoft Visual C++ Compiler Nov 2013 CTP\lib
You can also use the macros $(VC_CTP_Nov2013_LibraryPath_x86), $(VC_CTP_Nov2013_LibraryPath_x64), or $(VC_CTP_Nov2013_LibraryPath_ARM) depending on your target architecture.
If you had installed "CompilerCTP.Nov2013"Patch package, and using toolset of ctp2013,you can try to change toolset into 2013 with the following steps:
project -> property ->config property -> platform toolset ->Visual Studio 2013 (v120).

Cannot open include file: 'ntddk.h': No such file or directory

I am getting this error when I am trying to build my driver:
Driver.cpp(7): fatal error C1083: Cannot open include file: 'ntddk.h': No such file or directory
I am using Visual Studio 2012 with WDK 8.1 installed (I have not cinfigured anything in VS).
Any help is appreciated.
Go to project properties -> C/C++ -> General, and add ddk headers path to Additional Include Directories tab. It should be sth like $(WDKPATH)\inc\ddk where $(WDKPATH) is ofc a directory where You have installed WDK.
You need Visual Studio 2013 for WDK 8.1
Quote :
Important: Before installing WDK 8.1 Update, you need to install
Visual Studio 2013. See the Visual Studio links on this page.
I am using Visual Studio 2017 and I had the same issue when trying to compile a driver.
This solution help me:
You need to add WDK headers path to your vcxproj include directories:
vcxproj properties -> C/C++ -> General -> Additional Include Directories
C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\km\