Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get the exact compiler command line from visual studio?

I have to port the build of a DLL from building in Visual Studio to another build system. The DLL solution wasn't made by me and it's got lots of modified command line switches etc. I've copied the compiler/linker options from Visual Studio's

Project Properties -> Config Properties -> C/C++ -> Command Line Project Properties -> Config Properties -> Linker -> Command Line

However, when I build the DLL from my other build tool (and I've also tried a simple batch file) the DLL is a slightly different size and causes a crash sometimes when the DLL is used (which the one built by vis studio doesn't do).

So my question is:

  1. Is there a better way to see the exact command line than what's in vis studio properties page?

  2. Does Vis Studio do any crazy magic beyond what's happening on the command line (I hope the answer to this is no!) :-)

like image 323
Benj Avatar asked Oct 30 '09 11:10

Benj


People also ask

How do I get the command line in Visual Studio?

Start in Visual StudioOn the menu bar, select Tools > Command Line > Developer Command Prompt or Developer PowerShell.

How do I know which compiler I am using in Visual Studio?

You can select the compiler and corresponding toolset that will be used to build a project with the “Platform Toolset” property under General Configuration Properties for C++ projects. Any installed compilers that are applicable to your project type will be listed in the “Platform Toolset” dropdown.

What is Visual Studio compiler command line?

In this article The Visual Basic command-line compiler provides an alternative to compiling programs from within the Visual Studio integrated development environment (IDE). This section contains descriptions for the Visual Basic compiler options. Every compiler option is available in two forms: -option and /option .

Where is Visual Studio compiler located?

As explained above, the Microsoft C/C++ compiler is part of the Windows SDK and is natively included within your Visual Studio installation. More precisely, the default path where you'll find the compiler is C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin . The compiler is cl.exe .


1 Answers

Something to keep in mind is that command-line options can be set per-source file too, not just per-project, which may be what you're missing.

One way to see everything that's going on is to look at the build log. At the end of the build in the Output view, you should see a line like:

Build log was saved at "file path".

Ctrl-click the file path in the output view and it will load the log file, and you should see all of the command lines for each file.

Update:

This answer was for Visual Studio 2008. You no longer get the link in the output window in newer versions of Visual Studio. Instead you have to navigate to the build directory for your project to see the log file. See here:

https://msdn.microsoft.com/en-us/library/jj651643.aspx

Actually that link is slightly wrong. The log file has a .log extension rather than .txt.

like image 81
Gerald Avatar answered Oct 04 '22 22:10

Gerald