Is there a way to cancel the /DEBUG command line argument on Visual Studio's (2015+) link command?
I've tried /DEBUG:NO and /DEBUG- but neither is recognized.
In the project's properties, select the Linker -> Debugging options page and turn off "Generate Debug Info," as shown below:
(If this option is not shown, be sure that all other 'debug' options are disabled, such as "Use Debug Libraries" on the Configuration Properties -> Advanced page.)
Alternatively, to explicitly turn off the /DEBUG option in command-line builds, you can use the /DEBUG:NONE switch.
Related
How can I instruct CMake in the CMakeLists.txt to create a Visual Studio project that does not contain the /FP option?
Thanks
TL;DR: This seems to be impossible, at the moment. You may file a bug report on the
CMake Issue Tracker.
The default setting for "Full Path of Source Code File in Diagnostics" seems to be set to enabled. In Visual Studio, if you open the project's properties and navigate to Configuration Properties -> C/C++ -> Advanced, you will find the "Use Full Paths" property, which is enabled. You may also recognize that it is printed in a non-bold font, indicating a default value. Set it to "no" and it turns bold.
Saving the project will add a line to the <project>.vcxproj file:
[...]
<ClCompile>
[...]
<UseFullPaths>false</UseFullPaths>
</ClCompile>
[...]
Obviously, CMake needs to add this line to explicitly disable the compile flag. However, from a search of the repository, we learn that there is currently no implementation to achieve this. The FC flag is mapped to nothing or to true:
[...]
{ "UseFullPaths", "FC", "", "true", 0 },
[...]
Remember, both ways indicate to turn on "Full Path of Source Code File in Diagnostics".
To Conclude: There is no implementation in CMake, which allows to explicitly disable this flag. You have to write a post process script to change the <project>.vcxproj file accordingly.
I've created empty c/c++ project in VS2017 with options:
unchecked create directory for solution
added libcmt.lib as additional option in command line (Properties -> Linker -> Command Line)
Console (/SUBSYSTEM:CONSOLE) in SubSystem (Properties -> Linker -> System)
Generate Debug Information (/DEBUG) in Generate Debug Info (Properties -> Linker -> Debugging)
Debugger type: Mixed
masm in Build Customization files
The rest are default. Although those options debugger dosn't hit breakpoints in asm file. What could be the issue?
Right-click on the solution title in the Solution Explorer window, then go to Configuration Properties -> Configuration. The table appears, showing check-boxes, allowing to turn off/on a build of particular projects for certain configurations.
My solution and projects are generated with CMake.
Is it possible to turn off a particular project for Debug build configuration from CMakeLists.txt?
==
Background of a problem is failing build of Cython project for Debug config.
Release builds fine. CMake module was taken from this example on Github.
Debug config wants debug Python library python27_d.lib, that is forced by pyconfig.h. I use Anaconda python, which is missing this library.
Moreover, I don't need debug build of that project. I've unsuccessfully spent several hours, modifying CMakeLists.txt in various ways, trying to remove definition of _DEBUG macro from compiler command line. CLI parameter /D_DEBUG was absent in all dialogs with properties and "complete command line" listings, that Visual Studio has shown me. Nevertheless, something has always appended it.
So, I'd like to simply disable this project in Debug build for now.
This sets that check-box from the first part of the question to unchecked state:
set_property(TARGET <my Cython module>
PROPERTY EXCLUDE_FROM_DEFAULT_BUILD_DEBUG TRUE)
Now I wonder, where did compiler command line come from, because /D_DEBUG was absent in all dialogs with properties, that Visual Studio has shown me (second part of the question).
I am building this project in VS2013. Initially, that string /D_DEBUG was present in Project properties -> C/C++ -> Preprocessor -> Preprocessor definitions for the Debug configuration. Then I've added
string(REPLACE "/D_DEBUG" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
to my CMakeLists.txt file, building the Cython code, and that macro has disappeared from the Project properties.
Nevertheless, the project was still requiring python27_d.dll.
I've also added
#define _DEBUG
in one of files, and have got the following compiler warning
C:\projects\project\file.cpp(9): warning C4005: '_DEBUG' : macro redefinition
command-line arguments : see previous definition of '_DEBUG'
I might be blind, but I can't for the life of me find out where to set command line arguments for debugging in Visual Studio 2015.
In VS 2013 (and every other version I've used) you can add them in the Debugging section of a project properties page). Is there any way I can set them via the IDE in VS 2015?
For .Net builds, open project properties and select the Debug tab. Command line args can be added under the 'Start Options' section.
For native builds, open project properties and select the Debugging tab under Configuration Properties. Command line args can be added (for the local debugger) in the 'Command Arguments' field.
Right click the Project (not the Solution!) in Solution Explorer and select Properties >>> Debug >>> Start Options >>> Command line arguments
We need to surpress generation of debug symbols. The options availble under project properties/ configuration properties / c/c++ / general / debug information format, are equivalent to /Z7, /Zi and /ZI - I can't find a way to omit the /Zx flag entirely.
Unlike the situation here - we're building from the IDE.
I'm using visual studio 2010, and the project at hand is a static library.
EDIT:
Here's the view from my installation of VS2012. Is this some installation issue?? Are your Debug-Information-Format options different?
You can remove it manually:
Step 1. Compiler.
Selected "Configuration Properties > C/C++ > General > Debug Information Format"
Hit DEL
Step 2. Linker.
Also you need to disable generating Debug info for Linker
Selected "Configuration Properties > Linker > Debugging> Generate Debug Info" set to No
Step 3. Profiler.
Also set "Profile" to "No" in Linker > Advanced or you may still see PDB files generated!
First thing first - this is not recommended to disable .PDB generation, even for a Release Build!
Anyway, you just need to go:
Linker -> Debugging -> Generate Debug Info, and set it to No