c++ - g++: No such file or directory? -
(on linux, trying set sdl) i'm having time makefiles, i'm finding them hard learn. here error i'm getting.
g++: error: game.exe: no such file or directory make: *** [game.exe] error 1 here makefile. (any suggestions on making better great. i've kind of slapped whatever find work.)
#game make file target = game.exe objs = app.o\ app_oninit.o\ app_onevent.o\ app_onloop.o\ app_onrender.o \ app_oncleanup.o\ sdl_cflags := $(shell sdl-config --cflags) sdl_ldflags := $(shell sdl-config --libs) cflags = -wall -o libs = ldflags = $(target): $(objs) g++ $(cflags) $(sdl_cflags) $@ $(ldflags) $(objs) $(sdl_ldflags) $(libs) %.o: src/%.cpp g++ -c $(sdl_cflags) $< $(sdl_ldflags) .phony: clean clean: rm -f $(target) $(objs)
you either exchange $(cflags) , $(sdl_cflags) in rule make $(target) or better remove -o cflags , put directly before $@:
... cflags = -wall ... $(target): $(objs) g++ $(cflags) $(sdl_cflags) -o $@ $(ldflags) $(objs) $(sdl_ldflags) $(libs) -o option should precede name of executable file produced. in original makefile part of $(cflags) , followed c flags of sdl library. therefore compiler tries link in game.exe (the $@) instead of producing executable file name.
Comments
Post a Comment