Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Getting this error when trying to use SDL_mixer...

SDL_types.h file not found..

I am including all the correct files as far as I can tell and have included the frameworks (both SDL and SDL_mixer) to my /systems/library/frameworks folder and it compiles well until I add SDL_mixer.h to my project. What should I do?

Here is main.cpp

#include <SDL/SDL.h>
#include "SDLMain.h"
#include "SDL_mixer.h"


int main(int argc, char ** argv)
{
    SDL_Init(SDL_INIT_EVERYTHING);
    Mix_Chunk song;
    //Initialize SDL_mixer
    if( Mix_OpenAudio( 22050, MIX_DEFAULT_FORMAT, 2, 4096 ) == -1 )
    {
        return false;
    }

    song = Mix_LoadWAV("song.wav");
    SDL_SetVideoMode(1000, 500, 32, SDL_SWSURFACE);
    SDL_Event event;
    bool done = false;
    while(!done)
    {
        while (SDL_PollEvent(&event))
        {
            if (event.type == SDL_QUIT)
            {
                done = true;
            }
            if (event.type == SDL_KEYDOWN)
            {
                if (event.key.keysym.sym == SDLK_UP)
                {
                    Mix_PlayChannel( -1, song, 0 );
                }
            }
        }
    }
    SDL_Quit();

    return 0;
}

Thanks

share|improve this question
    
please post the exact error message. –  miguel.martin Feb 12 '13 at 11:44
    
By the way, you don't need to #include "SDLMain.h" –  miguel.martin Feb 12 '13 at 11:46
add comment

1 Answer 1

This is only a guess, but as far as I know you should include SDL as <SDL.h>. As I can see that you include SDL as <SDL/SDL.h> and SDL Mixer as "SDL_mixer.h", the problem is that the header of SDL_mixer.h includes <SDL_types.h>, but in your case it would have to be <SDL/SDL_types.h>.

You should either extend the include search path to include the SDL folder (prefered) or alter the SDL_mixer.h to refer to SDL/SDL_types.h (hacky).

share|improve this answer
    
I think that is it... Is there any way to configure xcode so I don't have to specify SDL/SDL.h? and just include "SDL.h" –  cipherous Feb 12 '13 at 21:56
    
Ok I totally never used xcode, bout you should have something along the lines of "additional include directories". This normally translates to some "-I" compiler directives. –  rioki Feb 13 '13 at 9:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.