Command line compiling in Windows

1. Required installation

Visual Studio Community |weblink here|.
SDK's should be added into Visual Studio menu "Tools / Get tools and features ..." by selecting at least Windows 11 SDK and Windows 10 SDK from "Installation details". When they are selected Visual Studio downloads them. Best choise should be "Download all, then install" from the dropdown selection.

1.1 Command line developing

VS Community comes with command line compiling possibility (which I have been used mostly). It is at least currently located in
  \Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars*.bat.
64-bit compiling environment is initialized with vcvars64.bat, which should be made as an handy desktop icon to open a command line window for compiling.
vcvarsall.bat file
Example for a simple compillation in that window: "CL.exe main.c init.c /link user32.lib gdi32.lib d3d11toCLANG.lib".

Using makefile is encouraged in specially when the amount of source files and interdependences increases. An example makefile:
# MAKE.MAK file

CFLAGS		= /EHsc /O2

LINKFLAGS	= /MACHINE:X64

OBJFILES	= main.obj createobjects.obj

LIBS		= user32.lib gdi32.lib kernel32.lib d3d11toCLANG.lib

main.obj:	main.c cinterface.h graphicalobjects.h cinterface.h primitives.h
	CL.exe /c $(CFLAGS) main.c

createobjects.obj:	createobjects.c graphicalobjects.h cinterface.h primitives.h
	CL.exe /c $(CFLAGS) createobjects.c

clean:
	del main.obj
	del createobjects.obj


Makefile could be run from convenient batch file like:
@*** MK.BAT ***
@ECHO OFF
NMAKE.exe /C /F MAKE.MAK

1.2 IDE developing

Graphical Visual Studio Community instance can also be used in development especially when deeper examination e.g. with break points is needed. In that case d3d11toCLANG.lib is to be added as an extra library file into project settings. You are encouraged to remove unicode from settings (Advanced / CharacterSet -> not set). Subsystem should be set to "Windows (/SUBSYSTEM: WINDOWS)" from Linker / System.
Visual studio extension loader

P.U. 7.6.2024, last modified 11.6.2024