Visual Studio 2012 C++ How to add compiler option in NMake project - c++

I am currently modifying on a open-source project to suit my own need, however, the project to be built (or compiler) requires me to add a /EHsc option to cl.exe
I am using Microsoft Visual Studio 2012 to work on the project. I have been searching long enough but I cannot find the solution still.
Is it possible to add a flag via MS Visual Studio 2012? Because I saw the output log displaying that compiler (cl.exe) compiled with various flag in this project such as /nologo /c /WX.
How can I add the options to cl.exe with this IDE?
Project working on : SumatraPDF
[Edit #1] After reading the first answer provided below, this is the screen I got, it doesn't seem there is an option to do so.

Update: From the screenshot you posted, it seems the SumatraPDF project is NMake-based.
Therefore, you will have to add /EHsc to the build command line, using the NMake property page described here, or edit the Makefile directly.
Original, misguided answer follows:
Per MSDN:
To set this compiler option in the Visual Studio development
environment
Open the project's Property Pages dialog box. For details, see How to: Open Project Property Pages.
Select the C/C++ folder.
Select the Code Generation property page.
Modify the Enable C++ Exceptions property.
Or, set Enable C++ Exceptions to No, and then on the Command Line
property page, in the Additional Options box, add the compiler option.

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.

visual studio builds with optimization flags even when disabled in options

I want to use openCV in my Qt project. But the release build crash and mixing release and debug causes bugs. So I made search and found that building openCV on my very computer setting the same flags (optimization flags) that my project may help.
So I used cmake to generate the openCV project, and open the openCV.sln in my visual studio. But even when I disable the optimization in the properties, the detailed log output shows me that there's /O2 in the cl.exe command line.
Any one get a solution? I don't know well how to use Visual Studio, maybe I can build project from command line?

Why is the Compile menu option is grayed out in my Visual Studio C++ makefile project?

So recently I was poking around C++ makefile projects using "Visual Studio 2012".
I grasped the concept of creating a proper makefile (file) and integrating it in the Visual Studio IDE in order to Build/Clean my project using just the GUI menu options, without the Command Line.
The only problem I have now is to compile a single file through the menu option:
Build->Compile (or the keys combination Ctrl+F7 in my case) which is disabled (grayed out) for some reason.
So first off I would like to know if that behavior is standard for C++ Makefile projects using Visual Studio or I might be missing something out.
In case the Compile menu option should be enabled, I would like to know how to setup my makefile project correspondingly.

Where is C++ /Zo in Visual Studio 2013 Update 3

http://www.visualstudio.com/news/2014-aug-4-vs
Mentions a new compiler switch for better debugging with optimizations on but I can't for the life of me find it.
Does anyone know where it is and how to turn it on?
C++
/Zo Compiler Switch
/Zo is a compiler switch that generates richer debugging information
for optimized code (non /Od builds). This includes improved support
for debugging local variables. (Minimum edition: Express)
See the documentation on MSDN here: /Zo (Enhance Optimized Debugging). For command-line builds, just add /Zo to the build commands. To add /Zo to a project in Visual Studio, open the Property Pages dialog for the project, and navigate to Configuration Properties > C/C++ > Command Line in the tree view control. Add /Zo to the Additional Options edit box, then click OK. You should be good to go. New options like this usually don't get added to the Project Properties dialog UI until the next major revision, so you have to use the Additional Options box to see them in action.
Note that there are some incompatible options such as native Edit and Continue, but that's an unusual thing to do in Release mode anyway.

Visual Studio Project always out of date, "up to date is missing #ECHO", why is Visual Studio looking for this input?

Background:
My team wants Visual Studio for development on an existing codebase, for its various tools, and that's what most developers are used to using. However, the existing build system (an internal flavor of Jam) is very entrenched, and for a variety of factors cannot be changed.
The idea:
Create a project for each component. I did this using a description generated by Jam of what files go into each library, and making that into a QT project file. I call qmake on this to generate Visual Studio projects with "qmake -tp vc".
Disable Visual Studio's build. I did this by changing the Type of each source file to "does not participate in build" (by changing each to )
Add a pre-build event that calls the Jam build.
Problem:
Now, when I try to build from Visual Studio, it works, in that it calls Jam.
However, I would expect Visual Studio to think the project is always up-to-date, considering it is not actually tracking any source files for compile. But it is always out-of-date, and must call the pre-build command before debugging (which attaches the debugger to the executable, and works just fine).
I used DebugView to see what was going on, and for many of my projects, I get the following in the log
[12900] Project '<my project's name>' is not up to date because 1 build inputs were missing.
[12900] devenv.exe Information: 0 :
[12900] up to date is missing: '<my project's location>\#ECHO'
I've searched high and low, but cannot find any reference to #echo as a file input to anything anywhere. Does anybody know, and/or is there a way to track down why it is looking for this?