Page 1 of 1

[SOLVED]GNU Make, SDL, Linux. No window, no process?

Posted: Tue May 08, 2012 11:49 pm
by MadPumpkin
I'm running Fedora OS, and I'm not much acquainted with actual development on a Linux OS so I'm having a bit of issues debugging my problem. I downloaded and installed SDL libraries with:

Code: Select all

sudo yum install SDL SDL-devel SDL_image SDL_image-devel SDL_mixer SDL_mixer-devel
and then ttf too. I technically broke it up into parts because I had no clue you didn't have to... Anyways I got them all successfully installed and what not without trouble, then I proceded to compile and it worked fine. The code besides the loop is really just from Lazy Foo. So when I try to run the app, nothing happens. When I run it from commandline, still nothing happens. Including running it with "sudo".

main.cpp

Code: Select all

#include "SDL/SDL.h"
using namespace std;

int main(int argc, char* args[])
{
	SDL_Surface* hello = NULL;
	SDL_Surface* screen = NULL;
	SDL_Init( SDL_INIT_EVERYTHING );
	screen = SDL_SetVideoMode( 800, 600, 32, SDL_SWSURFACE );
	hello = SDL_LoadBMP( "hello.bmp" );

	while(1)
	{
		SDL_BlitSurface( hello, NULL, screen, NULL );
		SDL_Flip( screen );
		SDL_Delay( 2000 );
	}

	SDL_FreeSurface( hello );
	SDL_Quit();
	return 0;
}
with the make file:

Code: Select all

IDIR=include
CC=g++
CFLAGS=-I$(IDIR)

ODIR=src/obj
LDIR=lib

LIBS=-lm -lSDL

_DEPS = 
DEPS = $(patsubst %,$(IDIR)/%,$(_DEPS))

_OBJ = main.o
OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ))


$(ODIR)/%.o: %.cpp $(DEPS)
	$(CC) -c -o $@ $< $(CFLAGS)

.PHONY: main
main: $(OBJ)
	g++ -o $@ $^ $(CFLAGS) $(LIBS)

.PHONY: clean

clean:
	rm -f $(ODIR)/*.o *~ core $(INCDIR)/*~ 

[SOLVED]GNU Make, SDL, Linux. No window, no process?

Posted: Wed May 09, 2012 2:32 pm
by MadPumpkin
I've solved the problem :O just some stupid Makefile bullshit with the .o object files is all.