Closed ghost closed 4 years ago
https://stackoverflow.com/questions/16911866/warning-resolving-func-by-linking-to-func
Thank you, now the warnings are gone.
set CGO_LDFLAGS=%CGO_LDFLAGS% -Wl,--enable-stdcall-fixup
Build.bat
@echo off
set APP_NAME="demo"
set APP_VER="1.0"
set LDFLAGS="-s -w -H=windowsgui"
set MINGW_64=E:\msys64\mingw64
set MINGW_32=E:\msys64\mingw32
set OS_WINDOWS_AMD64=true
set OS_WINDOWS_I386=true
rem Windows amd64
if %OS_WINDOWS_AMD64% == true (
echo Windows/amd64
set CGO_ENABLED=1
set GOOS=windows
set GOARCH=amd64
set PATH=%MINGW_64%\bin;%PATH%
set CC=x86_64-w64-mingw32-gcc
go build -o %APP_NAME%-v%APP_VER%-windows-amd64.exe -trimpath -ldflags=%LDFLAGS% .
)
rem Windows i386
if %OS_WINDOWS_I386% == true (
echo Windows/i386
set CGO_ENABLED=1
set GOOS=windows
set GOARCH=386
set PATH=%MINGW_32%\bin;%PATH%
set CGO_LDFLAGS=%CGO_LDFLAGS% -Wl,--enable-stdcall-fixup
set CC=i686-w64-mingw32-gcc
go build -o %APP_NAME%-v%APP_VER%-windows-i386.exe -trimpath -ldflags=%LDFLAGS% .
)
Result
Both executable files appear and work, but when compiled, it displays a warning.
Build.bat
Warning