0

Goodmorning guys,
I'm trying to compile a simple SDL project with gcc in mac OSX Maverick...
This is my main.c file:

#include <stdio.h>
#include <stdlib.h>
#include <SDL/SDL.h>

int main( int argc, char *argv[])
{
    SDL_Init(SDL_INIT_VIDEO);
    printf("Grande!\n");
    SDL_Quit();
    return 1;
}

In facts my function do nothing but I just want to see if I can compile.

So I've tried to compile like that gcc -lSDL -o main main.c, but I get the message:

ld: library not found for -lSDL
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I've included SDLMain.h and SDLMain.m files in the same folder of main.c
I've correctly installed SDL framework in /System/Library/Frameworks.
I've searched a lot around internet for a solution but I can't get one, so I ask if you have any suggestion
Thaks!

2
Contributors
1
Reply
11
Views
2 Years
Discussion Span
Last Post by Moschops
0

You can tell gcc specific directories to search for libraries with the -L switch, e.g.

-L/some/directory/that/you/know/the/library/is/in

On Linux, you don't have to bother doing all this yourself as there's a helpful expanding config to do it for you that you add to your gcc line; sdl-config --cflags --libs ( https://wiki.libsdl.org/FAQLinux#How_do_I_add_SDL_to_my_project.3F ). Is there not something similar for OSX?

Edited by Moschops

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.