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!

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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.