Need help with sdl programs

hi !
i am a second year engineering student doing information technology. i
wanted to use sdl for a graphics project, on ubuntu. i downloaded sdl 1.2.14
using the command line-“libsdl1.2-dev libsdl1.2 debian”.
i then wrote the following program on the vim editor.

#include “SDL.h” /* All SDL apps need this /
#include <stdio.h>
#include <stdlib.h> /
for exit() */

int main(int argc, char** argv) {

printf("Initializing SDL.\n");

/* Initialize defaults, Video and Audio subsystems */
if((SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO)==-1)) {
    printf("Could not initialize SDL: %s.\n", SDL_GetError());
    exit(-1);
}

printf("SDL initialized.\n");

printf("Quitting SDL.\n");

/* Shutdown all subsystems */
SDL_Quit();

printf("Quitting...\n");
exit(0);

}

the following errors appear after i compile it using gcc -o output
sourcefile.c ‘sdl-config --cflags --libs’

sdl2.c:10: error: ?SDL_INIT_VIDEO? undeclared (first use in this function)
sdl2.c:10: error: (Each undeclared identifier is reported only once
sdl2.c:10: error: for each function it appears in.)
sdl2.c:10: error: ?SDL_INIT_AUDIO? undeclared (first use in this function)
sdl2.c:11: warning: format ?%s? expects type ?char *?, but argument 2 has
type ?int?

can anyone help me out?
Thanks,

Regards,
Preeti

With the command line you gave I don’t think you actually got it installed.
Try: “sudo apt-get install libsdl1.2-dev libsdl1.2debian” instead.On Wed, Jan 27, 2010 at 9:55 PM, Preeti Murthy <preeti.murthy at gmail.com> wrote:

hi !
i am a second year engineering student doing information technology. i
wanted to use sdl for a graphics project, on ubuntu. i downloaded sdl 1.2.14
using the command line-“libsdl1.2-dev libsdl1.2 debian”.
i then wrote the following program on the vim editor.

#include “SDL.h”?? /* All SDL apps need this /
#include <stdio.h>
#include <stdlib.h> /
for exit() */

int main(int argc, char** argv) {

??? printf(“Initializing SDL.\n”);

??? /* Initialize defaults, Video and Audio subsystems */
??? if((SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO)==-1)) {
??? printf(“Could not initialize SDL: %s.\n”, SDL_GetError());
??? exit(-1);
??? }

??? printf(“SDL initialized.\n”);

??? printf(“Quitting SDL.\n”);

??? /* Shutdown all subsystems */
??? SDL_Quit();

??? printf(“Quitting…\n”);
??? exit(0);
}

the following errors appear after i compile it using gcc -o output
sourcefile.c ‘sdl-config --cflags --libs’

sdl2.c:10: error: ?SDL_INIT_VIDEO? undeclared (first use in this function)
sdl2.c:10: error: (Each undeclared identifier is reported only once
sdl2.c:10: error: for each function it appears in.)
sdl2.c:10: error: ?SDL_INIT_AUDIO? undeclared (first use in this function)
sdl2.c:11: warning: format ?%s? expects type ?char *?, but argument 2 has
type ?int?

can anyone help me out?
Thanks,

Regards,
Preeti


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Also, you should use backticks (`) around the sdl-config call instead of
single quotes (’).

Jonny DOn Wed, Jan 27, 2010 at 10:02 PM, Justin Coleman wrote:

With the command line you gave I don’t think you actually got it installed.
Try: “sudo apt-get install libsdl1.2-dev libsdl1.2debian” instead.

On Wed, Jan 27, 2010 at 9:55 PM, Preeti Murthy <preeti.murthy at gmail.com> wrote:

hi !
i am a second year engineering student doing information technology. i
wanted to use sdl for a graphics project, on ubuntu. i downloaded sdl
1.2.14
using the command line-“libsdl1.2-dev libsdl1.2 debian”.
i then wrote the following program on the vim editor.

#include “SDL.h” /* All SDL apps need this /
#include <stdio.h>
#include <stdlib.h> /
for exit() */

int main(int argc, char** argv) {

printf("Initializing SDL.\n");

/* Initialize defaults, Video and Audio subsystems */
if((SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO)==-1)) {
    printf("Could not initialize SDL: %s.\n", SDL_GetError());
    exit(-1);
}

printf("SDL initialized.\n");

printf("Quitting SDL.\n");

/* Shutdown all subsystems */
SDL_Quit();

printf("Quitting...\n");
exit(0);

}

the following errors appear after i compile it using gcc -o output
sourcefile.c ‘sdl-config --cflags --libs’

sdl2.c:10: error: ?SDL_INIT_VIDEO? undeclared (first use in this
function)
sdl2.c:10: error: (Each undeclared identifier is reported only once
sdl2.c:10: error: for each function it appears in.)
sdl2.c:10: error: ?SDL_INIT_AUDIO? undeclared (first use in this
function)
sdl2.c:11: warning: format ?%s? expects type ?char *?, but argument 2 has
type ?int?

can anyone help me out?
Thanks,

Regards,
Preeti


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org