I am trying to get compile some C code from within Cygwin on 64-bit Windows and call the executable using some parameters. The compilation goes through fine (the Makefile is below). But when I run the executable, I get the error cannot execute binary file
.
A quick shows that indeed the binary is built for Linux.
ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x7d39e30cb249d2047815de23a9df33fccf91a58f, not stripped
How can I change the Makefile so that it compiles for Windows?
Here is the Makefile
.SUFFIXES: .c .u
CC= gcc
CFLAGS = -g -Wall -O3 -DHAVE_INLINE -DGSL_RANGE_CHECK_OFF
# LDFLAGS = -lm -lgsl -latlas -lgslcblas
LDFLAGS = -lm -lgsl -lgslcblas
# LDFLAGS = -lm -lgsl -latlas -lcblas
LOBJECTS= a.o b.o c.o
LSOURCE= a.c b.c c.c
windows: $(LOBJECTS)
$(CC) $(LOBJECTS) -o stm $(LDFLAGS)
clean:
-rm -f *.o