Issue
I am trying to cross compile my hello world app on C from Ubuntu linux for Windows platform. So, to compile the app I am using this Makefile:
CC = g++
IDIR = -Iinclude
SRC = src
CFLAGS = -Wall -Wextra
LFLAGS = -mwindows
main.out: main.o
$(CC) $(CFLAGS) $(IDIR) $(LFLAGS) $^ -o $@
main.o: $(SRC)/main.c
$(CC) $(CFLAGS) $(IDIR) -c -o $@ $^
As the result of cmmand make -f windows.mk
I have such error:
g++: error: unrecognized command line option ‘-mwindows’
I have already tried gcc and g++. Is there way to compile it without making my own crosscompiler?
Solution
To cross compile for windows you would need mingw-w64 or use i686-w64-mingw32-g++
sudo apt-get install mingw-w64
For more info :
https://arrayfire.com/cross-compile-to-windows-from-linux/
Answered By - Altaf Answer Checked By - Marilyn (WPSolving Volunteer)