@echo off setlocal cd /d "%~dp0" rem === C Language TCP API Demo Client Build Script === rem This script uses the installed MinGW GCC compiler. rem It includes the new APItcpDemo files + QDXnetworkStack sources. set GCC_PATH=C:\MinGW\bin\gcc.exe echo Checking for GCC compiler... if not exist "%GCC_PATH%" ( echo [ERROR] GCC compiler not found at: %GCC_PATH% echo Please ensure MinGW is properly installed. exit /b 1 ) echo. echo ========================================= echo Building APItcpDemo (QDXnetworkStack API Client)... echo Target: api_demo.exe echo ========================================= echo. rem Compiler flags: -O2 optimization, strictly enable warnings set CFLAGS=-O2 -Wall -I../QDXnetworkStack rem Source files: Demo local sources + the QDXnetworkStack sources set SRC_FILES=demo_main.c qdx_port_win32.c ../QDXnetworkStack/qdx_tcp_logic.c ../QDXnetworkStack/qdx_protocol.c ../QDXnetworkStack/qdx_preprocess.c "%GCC_PATH%" %CFLAGS% %SRC_FILES% -o api_demo.exe -lws2_32 if %ERRORLEVEL% equ 0 ( echo. echo [SUCCESS] Build completed! Output file: api_demo.exe echo Usage example: Run 'api_demo.exe' and interact with the console. ) else ( echo. echo [FAILED] Build error. Please check the logs above. ) pause