ARTICLE AD BOX
In the 64-bit Windows 10 OS, I want to compile a 32-bit Windows executable via cl.exe with Visual Studio Code. I have installed C/C++, CMAKE and C/C++ DevTools extensions and installed Visuall C++ compiler and other devtools.
I can successfully compile a 64-bit executable, as cmd, as well as GUI program via cl.exe in VS Code.
What should I do to be able to compile 32-bit exe without need to restart VS Code (or at least that way)? Can it be done by editing `tasks.json` to switch between 32bit and 64bit?
In tasks.json I specified (with double quotes!) path to (seems to) x86 cl.exe, but it does not compile with a lot of "unresolved symbols" linker LNK2019 fatal errors and warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86' warnings.
All warnings have such location: C:\Program Files (x86)\Windows Kits\10\\lib\10.0.19041.0\\um\x64\user32.lib : warning LNK4272: ... So I probably need to change the static libs location. But where it can be done in VS Code and those extensions?
Current tasks.json
// C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\x86 { "tasks": [ { "type": "cppbuild", "label": "C/C++: cl.exe build active file", "command": "\"C:/Program Files (x86)/Microsoft Visual Studio/18/BuildTools/VC/Tools/MSVC/14.50.35717/bin/Hostx64/x86/cl.exe\"", "args": [ "/Zi", "/EHsc", "/nologo", "/Fe${fileDirname}\\${fileBasenameNoExtension}.exe", "${file}", "/link kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib" ], "options": { "cwd": "${fileDirname}" }, "problemMatcher": [ "$msCompile" ], "group": { "kind": "build", "isDefault": true }, "detail": "Task generated by Debugger." } ], "version": "2.0.0" }