Installer le compilateur MinGW-w64 gcc

sudo dnf install mingw64-gcc mingw64-binutils

Utiliser le compilateur gcc w64
x86_64-w64-mingw32-gcc pour compiler du C.
x86_64-w64-mingw32-g++ pour compiler du C++.
sans oublier x86_64-w64-mingw32-windres pour compiler les ressources.

Les makefiles
Pour une dll en C++

SRC=.
OBJ=obj
BIN=bin

target: $(BIN)/hostusb-windows-x86-64.dll

$(OBJ)/hostusb.o: $(SRC)/hostusb.cpp
	x86_64-w64-mingw32-g++ -c -shared -fpermissive  -o $(OBJ)/hostusb.o $(SRC)/hostusb.cpp 

$(OBJ)/hostini.o: $(SRC)/hostini.cpp
	x86_64-w64-mingw32-g++ -c -shared -fpermissive -o $(OBJ)/hostini.o $(SRC)/hostini.cpp 

$(OBJ)/hcd.o: $(SRC)/hcd.cpp
	x86_64-w64-mingw32-g++ -c -shared -fpermissive -o $(OBJ)/hcd.o $(SRC)/hcd.cpp 

$(BIN)/hostusb-windows-x86-64.dll: $(OBJ)/hostini.o $(OBJ)/hcd.o $(OBJ)/hostusb.o
	x86_64-w64-mingw32-g++ -shared -lstdc++ -lgcc_s -o $(BIN)/hostusb-windows-x86-64.dll $(OBJ)/hostusb.o $(OBJ)/hcd.o $(OBJ)/hostini.o 


Pour une application avec ressources
SRC=.
OBJ=Release/obj
BIN=Release

target: $(BIN)/qrtv.exe

$(OBJ)/resource.o: $(SRC)/resource.rc $(SRC)/resource.h
	x86_64-w64-mingw32-windres -O coff -o $(OBJ)/resource.o $(SRC)/resource.rc

$(OBJ)/about.o: $(SRC)/about.c
	x86_64-w64-mingw32-gcc -c -fpermissive -o $(OBJ)/about.o $(SRC)/about.c 

$(OBJ)/qrtview.o: $(SRC)/qrtview.c
	x86_64-w64-mingw32-gcc -c -fpermissive $(SRC)/qrtview.c -o $(OBJ)/qrtview.o

$(BIN)/qrtv.exe: $(OBJ)/about.o \
		 $(OBJ)/resource.o \
		 $(OBJ)/qrtview.o
	x86_64-w64-mingw32-gcc $(OBJ)/about.o \
	$(OBJ)/resource.o \
	$(OBJ)/qrtview.o
	-lstdc++ -lgcc_s -lcomdlg32 -lgdi32 -o $(BIN)/qrtv.exe
	strip $(BIN)/qrtv.exe