change microsoft compiler from vc14 to vc12 in devenv.exe - c++

I compile command line most of my applications using msvc12's vsvarsall.bat and setting the platform. Now I have a project that comes with a visual studio solution and it compiles with msvc14. To keep compatability I would like to compile with vc12. How do I switch compilers inside devenv.exe?

Open the project in msvc, then go to "Project -> Properties -> Configuration Properties -> General -> Platform Toolset".

Related

Qt with visual studio , Qt requires a c++17 compiler

I'm stuck on this, when i compile a project in Visual Studio i have this error at the ouput, telling that:
on nmvc you must the /Zc:__cplusplus option to the compiler (compiling source file QtdesignerWidget.cpp)
I tried the solution to add /Zc:__cplusplus in the project properties -C++ / Command line / Additional options withou success
And when i try to make a .pro file in QT VS tools it makes this error:
Warning : Cannot Find any Qt4 projects to export
Open the project's Property Pages dialog box. For details, see Set C++ compiler and build properties in Visual Studio.
Select the Configuration Properties > C/C++ > Command Line property page.
Add /Zc:__cplusplus or /Zc:__cplusplus- to the Additional options: pane.
The answer is taken from here: https://learn.microsoft.com/en-us/cpp/build/reference/zc-cplusplus?view=msvc-170
Same problem. Here are my platforms:
Qt version: 6.2.0
Qt Visual Studio Tools version: 3.4
Compiler version: VS2019_64
Luckily, I also installed Qt5.14.2 on my computer. When I changed configurations to: Qt5.14.2 and VS2017_64. Problem solved. So I guess VS2019 or Qt VS tools3.4 doesn't work well with Qt6.2.0.
You can have a try.
Are you sure your language standard is set to C++17 in the project settings?
Go to project properties --> General --> C++ Language Standard
In my case it was default set to C++14. This must be set to C++17.

Where are C/C++ Preprocessor settings in project properties UI in VS 2015 Community Edition?

With the hope of getting trained for C++ as a zero newbie, I was following directives to create a C++ dev environment on a PC equipped with Windows 10 and Visual Studio 2015 Community Edition.
I create a new C++ project on VS 2015 CE
When I right-click project properties, I cannot locate C/C++ > Preprocessor - it's just not there as can be seen from the screenshot.
So trying to figure out how on Earth I can add some custom preprocessor definitions here. :-(
Add at least one .cpp or .c file to your project (or, more generally, an item with ItemType "C/C++ Compiler").
A desired entry will appear in Project Property Pages (exactly where you expect it to be):
Configuration properties -> C/C++
There will be subentry "Preprocessor".
Alternatively, you may create a project of type
Visual C++ -> Win32 -> Win32 Console Application (or, more general, Win32 Project)
This type of projects already contains C++ files with some simple code.

How can i solve this error in my code C++

This error makes my code wrong & I can't debug my code correctly.
This is my screen when I am debugging my code:
I can't understand the error. What is it and how can it be solved?
It means you do not have SDK (and tools) for Windows XP target compilation.
You either need to:
change platform target of the Project ( Yer Project -> Properties -> General -> Platform Toolset)
or install that feature (Control Panels -> Programs and functions -> Visual Studio X -> modify -> select "Windows XP support for C++")

OpenCV with Visual Studio 2015 Enterprise

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

Linker error after upgrading solution to VS2012

I was developing a project that uses (among others) boost::filesystem under VS2010. Today I decided to switch to VS2012, upgraded the solution (just let the VS do it automatically) and when I tried to compile it seems all went fine except for 1 thing:
fatal error LNK1104: cannot open file 'libboost_filesystem-vc100-mt-gd-1_53.lib'
I keep boost in a separate folder (outside the project location), the paths seems to be correct (I have precompiled *.lib files of boost, both for VS2010 and VS2012). The error suggests the project looks for the old versions of libs (vc100 instead of vc110) but I have no idea how to change that.
Make sure the Platform Toolset option is set to v110. Right click on the project name and select Properties. Then under Configuration Properties -> General -> Platform Toolset select Visual Studio 2012 (v110).