Setting output path for cl.exe

11,145

Solution 1

Those are files produced by the linker. You'll need to run it separately or use the /link compiler option so you can control its output. Use the /OUT option to set the .exe and .ilk locations, the /PDB option to set the .pdb location.

Solution 2

Because (like DCoder said) cl.exe passes any command line options after /link to the linker, you can do it in 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

You can change files\newfilename.exe to be whatever you want. If you run from a batch file, you can do something like files\%1.exe and etc...

Share:
11,145
fithu
Author by

fithu

Updated on June 17, 2022

Comments

  • fithu
    fithu almost 2 years

    I'm using command line param Fo, command line is 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 still are produced outside of Debug folder (exe, ilk, pdb)
    What I'm doing wrong?