Problems compiling code using SDL 1.2

Hi there, deamons!

I've just installed sdl with the command [cmd=]portmaster devel/sdl12[/cmd]T hen I wrote a little code to test if everything went ok:

Code:
#include "SDL/SDL.h"
int main( int argc, char* args[] )
{
    SDL SDL_Init( SDL_INIT_EVERYTHING );
    SDL SDL_Quit();
    return 0;
}

and I compiled it: [cmd=]g++ -o test test.cpp -lSDL[/cmd] but I get that error message:
Code:
test.cpp:1.21:error: SDL/SDL.h: No such file or directory
prova.cpp: In function 'int main(int, char**)':
prova.cpp:5: error: 'SDL_INIT_EVERYTHING' was not declared in this scope
prova.cpp:5: error: 'SDL_Init' was not declared in this scope
prova.cpp:7: error: 'SDL_Quit' was not declared in this scope

So... why can't g++ see sdl libs if they are in /usr/local/include/SDL/? (checked with find command)
How can I solve that annoying problem? Thanks in advance!
 
On FreeBSD /usr/local/include is not in the default include path [nor is /usr/local/lib for libs].

Use the following to build it:

[CMD=]g++ -I/usr/local/include -L/usr/local/lib -o test test.cpp -lSDL[/CMD]

[CMD=](Note the capital I and capital L, not lowercase)[/CMD]

This will add /usr/local/include to the include paths to search, and /usr/local/lib to the lib paths to search. I'm assuming that if SDL puts includes in /usr/local, that libs will end up there too... if not, you won't need the -L/usr/local/include argument.

Regards,
Brandon Falk
 
Back
Top