Cześć :) Próbuję napisać Makefile dla małego programika pisanego w SDL 2.0 oraz C++ (aby kompilował i stworzył plik a.out dla uruchomienia), ale kiedy wpisuje w konsoli 'make' to wyskakuje przedziwny błąd, z którym nie umiem swobie poradzić.
g++ Game.cpp -w -lSDL2 -lSDL2_image -o gra_latajacy_obiekt
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
Makefile:19: recipe for target 'all' failed
make: *** [all] Error 1
To jest mój Makefile. Kiedy zamiast '-w' wpisuję '-c' to się kompiluje, ale nie tworzy się plik a.out. Jest to moja pierwsza przygoda z Makefile i będę wdzięczny za wszelkie wskazówki :)
#OBJS specifies wich files to compile as part of the project
OBJS = Game.cpp
#CC specifies wich compiler we-re using
CC=g++
#COMPILER_FLAGS speciefies the additional compilation options we-re using
# -w suppresses all warnings
COMPILER_FLAGS = -w
#LINKER_FLAGS specifies the libraries we-re linking against
LINKER_FLAGS = -lSDL2 -lSDL2_image
#OBJ_NAME specifies the name of our executable
OBJ_NAME = gra_latajacy_obiekt
#This is the target that compiles our executable all:
$(OBJS) $(CC) $(OBJS) $(COMPILER_FLAGS) $(LINKER_FLAGS) -o $(OBJ_NAME)