I'd like to run the Microsoft Visual Studio Compiler cl.exe
without invoking the preprocessor. Is this possible? I thought that simply compiling preprocessed source code (using the /c
flag) would make the preprocessor run being a no-op, but apparently that's not the case. I did a bit of benchmarking. Here's a little source file (main.cpp
) which just includes some code:
#include <iostream>
#include <string>
#include <windows.h>
Here are some different compiler invocations and their timings:
1: cl /c main.cpp ~1.02s 2: cl /EP main.cpp > main-preprocessed.cpp ~0.5s 3: cl /c main-preprocessed.cpp ~0.75s
It seems that compiling preprocessed source code is already a bit faster (the preprocessor doesn't need to do anything). However, the difference between 1 and 2 suggests that the actual compiler and assembler just needs a bit more 0.5s. So compiling the preprocessed source code (as done in step 3) is a bit slower than I hoped.
Is there any way to just run the compiler and assembler, without invoking the preprocessor? I'm interested in solutions for MSVC6 up to MSVC10.