Thread: Need some help with SDL and Dev-C++

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    2

    Question Need some help with SDL and Dev-C++

    (Yes, I'm a beginner)

    "ANSI C++ forbids implicit conversion from `void *' in assignment" pointing to this line:
    cvt.buf = malloc(dlen*cvt.len_mult);

    That's from one of the examples from SDL Introduction. (http://www.libsdl.org/intro/usingsound.html)
    I wonder why it doesn't work.

  2. #2
    Fingerstyle Guitarist taylorguitarman's Avatar
    Join Date
    Aug 2001
    Posts
    564
    When you use malloc you must must explicitly tell the compiler what data type the memory will be.

    buf in the SDL_AudioCVT struct is defined as a Uint8*. So you'd do something like this.

    cvt.buf = (Uint8 *) malloc( dlen * cvt.len_mult );

    Give that a try.
    If a tree falls in the forest, and no one is around to see it, do the other trees make fun of it?

  3. #3
    Registered User
    Join Date
    Feb 2002
    Posts
    2

    Thumbs up

    Thank you.
    Although I still can't hear any sound, I'm no longer stuck at that point.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. getting SDL to work with Dev-Cpp
    By linucksrox in forum Game Programming
    Replies: 5
    Last Post: 10-24-2005, 11:43 AM
  2. Grrr.... SDL Linking Problem
    By 7EVEN in forum Game Programming
    Replies: 5
    Last Post: 08-12-2005, 08:44 PM
  3. Allegro And SDL
    By 7EVEN in forum Game Programming
    Replies: 5
    Last Post: 08-10-2005, 10:22 AM
  4. OPENGL Dev C++; Fualty LIBS
    By Blizzarddog in forum C++ Programming
    Replies: 5
    Last Post: 01-02-2004, 09:40 AM
  5. Attention Dev C++ Sdl Users!
    By Blizzarddog in forum Game Programming
    Replies: 0
    Last Post: 05-11-2003, 02:09 PM