Hi all,
I’m having a strange problem with the SDL_Init() function whilst running my compiled app as root, under the Linux console. However, I have identified that this only happens when another object file is linked. I am using GCC 4.6.3. Here is my code:
init.c
#include <SDL/SDL.h>
void init() {
// Start SDL
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER);
}
void close() {
// Quit SDL
SDL_Quit();
}
main.c
#include "init.h"
int main(int argc, char* argv[]) {
init();
close();
return 0;
}
And here is my Makefile, in case my compile options are incorrect:
# Source files
SOURCES=main.o init.o
# Output binary name
OUTPUT=sdltest
# Flags for compilers
CFLAGS=-c -Wall
LFLAGS=-lSDL
all: $(SOURCES) link
clean:
rm *.o $(OUTPUT)
link:
gcc $(SOURCES) $(LFLAGS) -o $(OUTPUT)
All help will be appreciated!
- NFSGamer