Omid
Omid

Reputation: 283

How to set release/debug mode to compile a cpp file at a command prompt using Microsoft C++ toolset

I have a code that works fine in VS2019 release x86 mode but not in debug mode. Is there any way to use the release mode feature in the command line? For example an option for CL or link.exe. The CL command line syntax is

CL [option...] file... [option | file]... [lib...] [@command-file] [/link link-opt...]

Here is the list of MSVC compiler options: MSVC Compiler Options There are some optimization options such as /O1 /O2 but they don't produce the same results as the VS release build. Am I searching for the wrong thing? Thank you in advance for your help.

Update

I found out the correct option for my code is /MD for Runtime Library setting. So using the following line in command prompt, the release-mode results are reproduced:

>cl /MD app.cpp

Upvotes: 1

Views: 1800

Answers (1)

John Zwinck
John Zwinck

Reputation: 249404

Visual Studio's configuration properties for your project will tell you exactly what compiler and linker options are being used in each build configuration. See: https://learn.microsoft.com/en-us/cpp/build/working-with-project-properties?view=vs-2019

Upvotes: 2

Related Questions