I am on macOS and trying to cross compile golang (CGO 1.10) executable for Windows using mingw-w64 installed from homebrew.

I have golang package with only one function (SimpleQRDecode) that calls other function from my c++ source (FindAndDecodeQR, uses zxing c++ port).

CGO_ENABLED=1 CXX="x86_64-w64-mingw32-g++" CXX_FOR_TARGET="x86_64-w64-mingw32-g++" CC="x86_64-w64-mingw32-gcc" CC_FOR_TARGET="x86_64-w64-mingw32-gcc" GOOS=windows GOARCH=amd64 go build -x
go build
#ifdef __cplusplus
extern "C" {
#endif

const char* FindAndDecodeQR(char *raster, int size, int width, int height);


#ifdef __cplusplus
}
#endif