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

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
MadPumpkin
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 484
Joined: Fri Feb 13, 2009 4:48 pm
Current Project: Octopia
Favorite Gaming Platforms: PS1-3, Genesis, Dreamcast, SNES, PC
Programming Language of Choice: C/++,Java,Py,LUA,XML
Location: C:\\United States of America\Utah\West Valley City\Neighborhood\House\Computer Desk

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

Post 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)/*~ 
Last edited by MadPumpkin on Wed May 09, 2012 2:32 pm, edited 1 time in total.
While Jesus equipped with angels, the Devil's equipped with cops
For God so loved the world that he blessed the thugs with rock
Image
Image
Image
User avatar
MadPumpkin
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 484
Joined: Fri Feb 13, 2009 4:48 pm
Current Project: Octopia
Favorite Gaming Platforms: PS1-3, Genesis, Dreamcast, SNES, PC
Programming Language of Choice: C/++,Java,Py,LUA,XML
Location: C:\\United States of America\Utah\West Valley City\Neighborhood\House\Computer Desk

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

Post by MadPumpkin »

I've solved the problem :O just some stupid Makefile bullshit with the .o object files is all.
While Jesus equipped with angels, the Devil's equipped with cops
For God so loved the world that he blessed the thugs with rock
Image
Image
Image
Post Reply