SDL first try problem!!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ivan

    #1

    SDL first try problem!!

    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_GetVideoInf o ();

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


    }

  • pete

    #2
    Re: SDL first try problem!!

    Ivan wrote:
    [color=blue]
    > my C code:
    >
    > #include <SDL/SDL.h>
    > #include <SDL/SDL_image.h>[/color]



    See if you can find a newsgroup
    where somebody should know what SDL is.

    --
    pete

    Comment

    • David Resnick

      #3
      Re: SDL first try problem!!


      Ivan wrote:[color=blue]
      > 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_GetVideoInf o ();
      >
      > if ( vInfo->hw_available )
      > printf("HW: OK");
      >
      >
      > }[/color]

      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_GetVideoInf o returns NULL. Perhaps you could
      add a check for that prior to dereferencing the pointer?

      -David

      Comment

      • Ivan

        #4
        Re: SDL first try problem!!

        OOPS -_-'

        i'm sorry ^_^

        Comment

        • August Karlstrom

          #5
          Re: SDL first try problem!!

          Ivan wrote:[color=blue]
          > #include <SDL/SDL.h>
          > #include <SDL/SDL_image.h>
          > #include <stdio.h>
          >
          >
          > int main(void){
          >
          > const SDL_VideoInfo *vInfo;
          >
          > vInfo= SDL_GetVideoInf o ();
          >
          > if ( vInfo->hw_available )
          > printf("HW: OK");
          >
          >
          > }
          >[/color]

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


          August

          --
          I am the "ILOVEGNU" signature virus. Just copy me to your
          signature. This email was infected under the terms of the GNU
          General Public License.

          Comment

          • Ivan

            #6
            Re: SDL first try problem!!

            tnx August ^_^

            Comment

            • Mike Wahler

              #7
              Re: SDL first try problem!!

              "Ivan" <ivan_vinn@hotm ail.com> wrote in message
              news:1132752718 .694508.67740@f 14g2000cwb.goog legroups.com...[color=blue]
              > Hi all,
              > i', tryng to make this code work .....
              >
              > it compiles but , when i exec, i've got Segmentation Fault
              >
              > Where i was wrong???[/color]

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

              -Mike



              Comment

              • Joe Estock

                #8
                Re: SDL first try problem!!

                Ivan wrote:[color=blue]
                > OOPS -_-'
                >
                > i'm sorry ^_^
                >[/color]

                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

                Comment

                Working...