Setting the output path for cl.exe

I use the Fo command line option, the command line looks like this:

file1.c  /ZI /nologo /W3 /WX- /Od /Oy- /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /Gm /EHsc /RTC1 /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /analyze- /errorReport:queue /bigobj /FdDebug\vc100.pdb /FoDebug\ /FaDebug\

But some files are still being created outside the Debug folder (exe, ilk, pdb)
What am I doing wrong?

+3
source share
2 answers

These are files created by the linker. You will need to run it separately or use the / link compiler option so that you can control its output. Use the / OUT option to set .exe and .ilk locations, the / PDB option to set .pdb locations.

+3
source

Because (for example, DCoder said ) cl.exepasses any command line parameters after /linkto the linker, you can do this on one line:

cl.exe <all your cl arguments here> /link user32.lib <and other lib here> /libpath:"C:\Program Files\Microsoft SDKs\windows\v7.0A\Lib\" /out:files\newfilename.exe

files\newfilename.exe . , - files\%1.exe ..

0

All Articles