Visual C ++ Command Line Compiler (CL.EXE) Reassign OBJ Files

The compiler (CL.EXE) can accept several source files, but likes to generate all OBJ files in the directory that it is called. I could not find the compiler flag for setting the output directory, but I found it for a separate OBJ, but it cannot use multiple sources.

Without specifying each file to redirect output and having many goals for NMAKE, is there an easy way to do this through the CL?

+6
source share
1 answer

It turns out that the /Fo option does work, but the directory you specify should end with a backslash. Thus,

 cl /Fo.\obj\ -c foo.c fee.c 

It works, but cl /Fo.\obj -c ... will fail.

+9
source

Source: https://habr.com/ru/post/898931/


All Articles