Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22456

Creating my own makefile [Error 255]

$
0
0

I have been enjoying the luxury of coding with an IDE that writes my makefile's for me, Iv decided that I have been 'short cutting' for far to long, so I have read a few manuals and watched a few videos on makefiles and have a makefile semi-done, the only trouble that I'm having is I'm not sure how to link libraries.

CPPS := $(shell ls src/*cpp)
TEMP := $(subst src/,obj/,$(CPPS))
OBJS := $(subst .cpp,.o,$(TEMP))
HEADERS := $(shell ls inc/*.h)
EXEC := bin/testfile

all: $(EXEC)

$(EXEC) : $(OBJS) $(HEADERS)
g++ -I inc/ $(OBJS) -o $(EXEC) -lSDL -lGLU
$(EXEC)

obj/%.o: src/%.cpp
g++ -Wall -I inc/ -c $< -o $@

ps: just incase I am saying the wrong thing when I say 'Library flags' I mean -lSDL -lGLU etc...

Wherever I put them they dont seem to work.

This is the error I get when I insert the lib flags, make: *** [bin/testfile] Error 255

The Error 255 is produced by make as a result of its command shell not being able to find a command for a particular rule.

If i dont include them I get standard 'undefined' messages.

Any help with this would be greatly appreciated! Thank you


Viewing all articles
Browse latest Browse all 22456

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>