project-navigation
Personal tools

Author Topic: SDL_Mixer with Dev-C++  (Read 5631 times)

Silver

  • Guest
SDL_Mixer with Dev-C++
« on: October 06, 2007, 10:15:52 am »
Hello,

I'm using Dev-C++ and TortoiseSVN on Windows XP.  I've been compiling and running the program for a month or so, but I've had a problem getting the code to compile ever since you switched to using SDL_Mixer for audio. 

The problem began after I updated to the revision where the audio C files were removed.  When I opened the ufo project, I got several "missing file" errors, although these files appear to now be unnecessary.  After checking the latest information in the wiki, I installed the SDL_Mixer devpack using the package manager.  When I attempted to compile the program, I got several compilation errors.  I was able to overcome this by moving the SDL_Mixer.h file to the C:\Dev-CPP\include\SDL folder.  Now it compiles fine, but I get many linker errors.  I assume these problems are related to a missing library from SDL_Mixer.  I tried moving the SDL_Mixer.lib file to the C:\Dev-CPP\lib folder.  I've tried adding the C:\Dev-CPP\SDL_Mixer-1.2.8\lib folder to the library folder list in compiler options.  I've looked at some tutorials about using SDL_Mixer, and according to them, I've done everything necessary to install the devpack.

I know I'm probably just overlooking something simple.  Your help is appreciated.

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: SDL_Mixer with Dev-C++
« Reply #1 on: October 06, 2007, 11:07:09 am »
the best thing would be when you would switch to codeblocks - the codeblocks package is maintained by me and up-to-date. See the wiki article for codeblocks and use the prepackaged version of codeblocks from http://mattn.ninex.info/download/Codeblocks_install.zip - just unzip it, and set up the paths as described in the codeblocks wiki article, nothing more is needed to compile the game. I'm not sure whether we will keep the dev-cpp project files. this ide is no longer under active development.

Offline smalul

  • Rookie
  • ***
  • Posts: 35
    • View Profile
Re: SDL_Mixer with Dev-C++
« Reply #2 on: October 06, 2007, 11:07:45 am »
I have a similar problem.
In Dev-C++ the missing files are: \src\client\snd_ref.c, \src\client\snd_mix.c, \src\client\snd_loc.c, \src\client\snd_ogg.c, \src\client\snd_ogg.h, \src\client\snd_wave.c, and \src\client\snd_wave.h. UFO.EXE won't compile of course.

In Code::Blocks, it stops at "#include <SDL_mixer.h>", and I get these errors:
Code: [Select]
:: === ufo, windows ===
D:\UFOAI SC\src\client\cl_sound.h:32: SDL_mixer.h: No such file or directory
D:\UFOAI SC\src\client\cl_sound.h:51: error: syntax error before "Mix_Chunk"
D:\UFOAI SC\src\client\cl_sound.h:51: warning: no semicolon at end of struct or union
D:\UFOAI SC\src\client\cl_sound.h:54: error: syntax error before '}' token
D:\UFOAI SC\src\client\cl_sound.h:54: warning: type defaults to `int' in declaration of `sfx_t'
D:\UFOAI SC\src\client\cl_sound.h:54: warning: data definition has no type or storage class
D:\UFOAI SC\src\client\cl_sound.h:58: error: syntax error before "Mix_Music"
D:\UFOAI SC\src\client\cl_sound.h:58: warning: no semicolon at end of struct or union
D:\UFOAI SC\src\client\cl_sound.h:61: error: syntax error before '}' token
D:\UFOAI SC\src\client\cl_sound.h:61: warning: type defaults to `int' in declaration of `music_t'
D:\UFOAI SC\src\client\cl_sound.h:61: warning: data definition has no type or storage class
D:\UFOAI SC\src\client\cl_sound.h:68: error: syntax error before "sfx_t"
D:\UFOAI SC\src\client\cl_sound.h:70: error: syntax error before '*' token
D:\UFOAI SC\src\client\cl_sound.h:70: warning: type defaults to `int' in declaration of `S_RegisterSound'
D:\UFOAI SC\src\client\cl_sound.h:70: warning: data definition has no type or storage class
D:\UFOAI SC\src\client\cl_actor.c:: In function `CL_ActorDoThrow':
D:\UFOAI SC\src\client\cl_actor.c:2771: error: `sfx' undeclared (first use in this function)
D:\UFOAI SC\src\client\cl_actor.c:2771: error: (Each undeclared identifier is reported only once
D:\UFOAI SC\src\client\cl_actor.c:2771: error: for each function it appears in.)
D:\UFOAI SC\src\client\cl_actor.c:: In function `CL_PlayActorSound':
D:\UFOAI SC\src\client\cl_actor.c:4121: error: `sfx' undeclared (first use in this function)
:: === Build finished: 11 errors, 8 warnings ===

Trunk 12234
Win XP SP2

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: SDL_Mixer with Dev-C++
« Reply #3 on: October 06, 2007, 01:38:24 pm »
looks like you are using an old codeblocks package - redownload it

add cl_sound.c to the dev-cpp ufo.dev project file and it should compile, too

Silver

  • Guest
Re: SDL_Mixer with Dev-C++
« Reply #4 on: October 06, 2007, 09:21:41 pm »
Got it working...  Had to add cl_sound.c to the project and add -lSDL_Mixer to the linker parameters.  Thanks for the help.