Search notes:

cl /Fo

The /Fo option specifies the name of the object file to be created.
This option is especially useful in combination with the /c option.
Note: there is no space or colon between the /Fo option and the name (which is confusing because the linker option /OUT requires a colon).
Note also, that cl has a -o option to name the object file. However, this option is deprecated (Warning message being Command line warning D9035: option o has been deprecated and will be removed in a future release).
The following Makefile demonstrates the usage of /Fo and /Fe to create obj files and an exe file:

main.c

#include "func.h"

int main() {
    func();
    return 0;
}
Github repository about-cl, path: /options/F/o/main.c

func.c

#include <stdio.h>
#include "func.h"

void func() {
  printf("func says hello\n");
}
Github repository about-cl, path: /options/F/o/func.c

func.h

void func();
Github repository about-cl, path: /options/F/o/func.h

Makefile

prog.exe: main.o func.o
	@cl /nologo main.obj func.obj /Feprog.exe

main.o : main.c func.h
	@cl /nologo /c main.c         /Fomain.obj

func.o : func.c func.h
	@cl /nologo /c func.c         /Fofunc.obj
Github repository about-cl, path: /options/F/o/Makefile

See also

cl /F…

Index