Friday, October 28, 2022

[SOLVED] Is Visual C++ as powerful as gcc?

Issue

My definition of powerful is ability to customize.

I'm familiar with gcc I wanted to try MSVC. So, I was searching for gcc equivalent options in msvc. I'm unable to find many of them.

controlling kind of output

Stop after the preprocessing stage; do not run the compiler proper.
gcc: -E
msvc: ???

Stop after the stage of compilation proper; do not assemble.
gcc: -S
msvc: ???

Compile or assemble the source files, but do not link.
gcc: -c
msvc:/c

Useful for debugging

Print (on standard error output) the commands executed to run the stages of compilation.
gcc: -v
msvc: ???

Store the usual “temporary” intermediate files permanently;
gcc: -save-temps
msvc: ???
  1. Is there some kind of gcc <--> msvc compiler option mapping guide?
  2. gcc Option Summary lists more options in each section than Compiler Options Listed by Category. There are hell lot of important and interesting things missing in msvc. Am I missing something or msvc is really less powerful than gcc.

Solution

MSVC is an IDE, gcc is just a compiler. CL (the MSVC compiler) can do most of the steps that you are describing from gcc's point of view. CL /? gives help.

E.g.

Pre-process to stdout:

CL /E

Compile without linking:

CL /c

Generate assembly (unlike gcc, though, this doesn't prevent compiling):

CL /Fa

CL is really just a compiler, if you want to see what commands the IDE generates for compiling and linking the easiest thing to look at the the command line section of the property pages for an item in the IDE. CL doesn't call a separate preprocessor or assembler, though, so there are no separate commands to see.

For -save-temps, the IDE performs separate compiling and linking so object files are preserved anyway. To preserve pre-processor output and assembler output you can enable the /P and /Fa through the IDE.

gcc and CL are different but I wouldn't say that the MSVC lacks "a hell lot" of things, certainly not the outputs that you are looking for.



Answered By - CB Bailey
Answer Checked By - Cary Denson (WPSolving Admin)