Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Visual C++ as powerful as gcc?

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.
like image 912
claws Avatar asked Jun 24 '10 06:06

claws


People also ask

Should I use MSVC or MinGW?

Is MinGW (MinGW-64) better than Cygwin in terms of MSVC alternative for creating Windows application? If your program will run only on Windows, then MinGW is likely the better choice. MinGW is designed to create Windows applications. It doesn't require users to install additional software to run your application.

Does Visual Studio use GCC?

Visual Studio's C++ Android development natively supports building your projects with the GCC that ships with the Android NDK, just like it does for Clang. You can also target Linux – either remotely or locally with the Windows Subsystem for Linux – with GCC. Compiler options for GCC.

Is Visual Studio a good compiler?

Microsoft Visual Studio is a good compiler for developing Windows applications.

Is Clang better than MSVC?

The c++ code compiled by clang runs a lot faster than the same code compiled by MSVC. And I checked the ASM code, found out that clang automatically uses SIMD instructions for speed purposes.


1 Answers

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.

like image 199
CB Bailey Avatar answered Oct 05 '22 23:10

CB Bailey