SDL first try problem!!

I

Ivan

Hi all,
i', tryng to make this code work .....

it compiles but , when i exec, i've got Segmentation Fault

Where i was wrong???
(i'm using Gcc)

my C code:

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


int main(void){

const SDL_VideoInfo *vInfo;

vInfo= SDL_GetVideoInfo ();

if ( vInfo->hw_available )
printf("HW: OK");


}
 
D

David Resnick

Ivan said:
Hi all,
i', tryng to make this code work .....

it compiles but , when i exec, i've got Segmentation Fault

Where i was wrong???
(i'm using Gcc)

my C code:

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


int main(void){

const SDL_VideoInfo *vInfo;

vInfo= SDL_GetVideoInfo ();

if ( vInfo->hw_available )
printf("HW: OK");


}

Details of how SDL (whatever it is) are not on topic
in comp.lang.c. If your problem is in SDL, you should
find a newsgroup that does that.

One generic C problem that could cause you woe is if
SDL_GetVideoInfo returns NULL. Perhaps you could
add a check for that prior to dereferencing the pointer?

-David
 
A

August Karlstrom

Ivan said:
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
#include <stdio.h>


int main(void){

const SDL_VideoInfo *vInfo;

vInfo= SDL_GetVideoInfo ();

if ( vInfo->hw_available )
printf("HW: OK");


}

<off-topic>
You first have to initialize the library with SDL_Init.
</off-topic>


August
 
M

Mike Wahler

Ivan said:
Hi all,
i', tryng to make this code work .....

it compiles but , when i exec, i've got Segmentation Fault

Where i was wrong???

When using a third-party library, it usually
helps tremendously to Read The Directions
before using.

-Mike
 
J

Joe Estock

Ivan said:
OOPS -_-'

i'm sorry ^_^

Opps what? Sorry for what? Did you stub your toe and are now sorry for
doing so? Did you spend a little more of your check than you should have
and are now sorry that you are broke? Please provide enough context of
the previous post for others to know what you are replying to. Not all
news servers store the previous messages in a thread, therefore not all
others are able to go back to the previous article.

Joe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top