c - GCC exiting with an error 1 even with -Wall. No explanation why? -
so tried recompile 1 of projects few weeks ago , surprise keep receiving error 1 on it. used mingw compile , eclipse cdt. have -wall flag enabled on gcc assumed if problem code have more useful information make error 1 being thrown. such, suspect issue lie in how formatted make file. luckily, did compile project when push commits last time , binaries still in repo. nevertheless, appreciate can continue improve project.
edit: when -all, refuses compile.
here makefile. hope simple me following incorrect syntax:
cc=gcc -i../include -l..\lib override cflags+=-wall -o3 #$(shell pkg-config --cflags fftw3) #override ldflags+=#$(shell pkg-config --libs fftw3 glib-2.0) -lm .phony: clean all: lvdoenc lvdodec lvdoenc: lvdoenc.o lvdomain.o $(cc) $(cflags) -o $@ $^ $(ldflags) -i../include -l../lib -lfftw3 lvdodec: lvdodec.o lvdomain.o $(cc) $(cflags) -o $@ $^ $(ldflags) -i../include -l../lib -lfftw3 %.o: %.c $(cc) -c $(cflags) -o $@ $^ lvdoenc.c: lvdocommon.h lvdodec.c: lvdocommon.h clean: rm -f lvdoenc lvdodec lvdomain.o lvdoenc.o lvdodec.o
here link repo: https://github.com/skylion007/lvdowin
update: using of answers have confirmed gcc exiting error 1 , cannot figure out why.
update2: it's not printing syserr.
without transcript of make's output, when run it, can't see why gcc should fail silently, can see @ least 2 problems makefile:
since state using mingw, target platform must ms-windows, on executable files should qualified
.exe
extension; thus,all: lvdoenc lvdodec
rule malformed; should, @ leastall: lvdoenc.exe lvdodec.exe
[1], (or better, portabilityall: lvdoenc$(exeext) lvdodec$(exeext)
, defineexeext = .exe
windows, , leaveexeext
undefined, or defined nothing, platforms don't require extension).your 2 rules
lvdoenc.c: lvdocommon.h
,lvdodec.c: lvdocommon.h
incorrect;.c
files don't depend on.h
, respective.o
files do. thus, these 2 rules shouldlvdoenc.o: lvdocommon.h
,lvdodec.o: lvdocommon.h
respectively.
[1] of course, need correctly refer these 2 "goals" respectively, lvdoenc.exe
, lvdodec.exe
, (or lvdoenc$(exeext)
, lvdodec$(exeext)
), consistently, throughout makefile.
there few other constructs, within makefile, consider questionable: cc
shouldn't defined, -i../include
or -l..\lib
, (and why inconsistently /
in former, \
in latter? both should /
). conventionally, -i ...
belongs in cppflags
, , -l ...
in ldflags
, both cflags
, cppflags
passed compiler, , all of cflags
, cppflags
, , ldflags
passed compiler driver, when invoking linker, (although, others have noted in comments, -i ...
settings strictly necessary when compiling .c
.o
, while -l ...
settings required in linking phase).
Comments
Post a Comment