Getting Mikmod Working


motorollin

Member
Joined
Jul 31, 2007
Messages
163
I have #include-ed mikmod.h in my app and added the following lines to my code:
CODE
MikMod_RegisterAllDrivers();
MikMod_RegisterLoader(&load_mod);
md_mode |= DMODE_SOFT_MUSIC;
MikMod_Init("");
module = Player_Load("snd/stardust.mod", 32, 0 );
if (module) {
Player_Start(module);
while (Player_Active()){
MikMod_Update();
}
Player_Stop();
Player_Free(module);
}else printf("impossible de lire le module\n");

MikMod_Exit();


When I compile I get the following errors:

win/main.o:main.c:(.text+0x3664): undefined reference to `MikMod_RegisterAllDrivers'
win/main.o:main.c:(.text+0x366b): undefined reference to `load_mod'
win/main.o:main.c:(.text+0x3670): undefined reference to `MikMod_RegisterLoader'
win/main.o:main.c:(.text+0x3677): undefined reference to `md_mode'
win/main.o:main.c:(.text+0x3680): undefined reference to `md_mode'
win/main.o:main.c:(.text+0x368c): undefined reference to `MikMod_Init'
win/main.o:main.c:(.text+0x36a8): undefined reference to `Player_Load'
win/main.o:main.c:(.text+0x36c3): undefined reference to `Player_Start'
win/main.o:main.c:(.text+0x36c8): undefined reference to `Player_Active'
win/main.o:main.c:(.text+0x36d1): undefined reference to `MikMod_Update'
win/main.o:main.c:(.text+0x36d8): undefined reference to `Player_Stop'
win/main.o:main.c:(.text+0x36e5): undefined reference to `Player_Free'
win/main.o:main.c:(.text+0x36f8): undefined reference to `MikMod_Exit'

I have googled the errors but can't find anything in English :blink:
 
Thanks. I just looked in the MikMod documentation and it says the command line to compile the example application contains "`libmikmod-config --cflags` `libmikmod-config --libs`", but when I compile I get an error "g++.exe: `libmikmod-config: No such file or directory". I tried copying that file from the MikMod archive in to my include directory, but it still doesn't work. Am I being an idiot here? :lol:
 
your on windows, so you need to put libmikmod-config into your path, it should be an executable (I dont know if its compiled or a script).

you could try putting it in the same directory as gcc.exe and see if it works.
 
YakumoFuji said:
your on windows, so you need to put libmikmod-config into your path, it should be an executable (I dont know if its compiled or a script).

you could try putting it in the same directory as gcc.exe and see if it works.
Looks like the archive I've got is the source version of MikMod, which according to the Win32 Readme will only compile on the "Microsoft" compiler. Does anyone have a binary of MikMod with the Win32 version of libmikmod-config?

Edit-
Oh hang on it's a script. I'll try putting it in the path...

Edit2-
Hmm, put libmikmod-config in bin (where g++.exe is), in include, and also in include/mikmod, but I still get the same error.
 
Last edited by a moderator:
Just installed Fedora Core linux under Parallels. Which is the best GP2X SDK for use under Linux? I'll be using SDL and, hopefully, MikMod.
 
open2x.

get the svn toolchain + build it,
then download the prebult library package and install it.
 
Thanks. Open2x is building now. Hopefully MikMod will work in that! Out of interest does Open2x have a front end or is it all command-line?
 
Also is it normal for the build script to hang for ages on "checking for memmove... yes"? Mine has been on that for ages and hasn't moved, though sh still shows as using a lot of CPU time in top, so I'm not sure whether or not it's doing anything. There's no disk activity.
 
Never mind, the build completed. Is there a sample makefile anywhere? If I try to compile with the makefile from Dev-C++ I just get a message that there's nothing to do in main.c.
 
motorollin said:
Never mind, the build completed. Is there a sample makefile anywhere? If I try to compile with the makefile from Dev-C++ I just get a message that there's nothing to do in main.c.
do a make clean, then do make
 
Last edited by a moderator:
Hmm, just tried it and got the same error. In my project folder I have main.c, Makefile.gp2x, Makefile.win, and folders called gp2x and win which contain the .o files. All of this was created by Dev-C++ under Windows. I'm wondering whether I need a new makefile for compiling under Linux?
 
motorollin said:
Hmm, just tried it and got the same error. In my project folder I have main.c, Makefile.gp2x, Makefile.win, and folders called gp2x and win which contain the .o files. All of this was created by Dev-C++ under Windows. I'm wondering whether I need a new makefile for compiling under Linux?
doesnt look like the clean worked delete all of the .o files and gpe and try make again.
 
Last edited by a moderator:
$ ls *.o
ls: *.o: No such file or directory
$ ls gp2x/*.o
ls: gp2x/*.o: No such file or directory
$ ls win/*.o
ls: win/*.o: No such file or directory
$ ls *.gpe
ls: *.gpe: No such file or directory
$ make main.c
make: Nothing to be done for `main.c'.
 
Just type 'make', not 'make main.c'. 'make' will look for a target called 'all' in a file called Makefile and do whatever that says. 'make main.c' will look for a target called main.c, which probably isn't what you want to be doing (unless you have a target called main.c). You also say you have two makefiles, so to compile for windows you should be using 'make -f Makefile.win', and for the gp2x use 'make -f Makefile.gp2x'.
 
Ahhh, progress :) When I type that I get:

cygwin-mkdir -p "gp2x"
/bin/sh: cygwin-mkdir: command not found
make: *** [all-before] Error 127


I'm guessing this is because my makefile is from a Windows G++ IDE which must use Cygwin. Is there an example open2x makefile I can use?

Edit-
Think I'm getting there. Copied Makefile.gp2x to Makefile and changed its MKDIR = line to MKDIR=mkdir -p and it gets further now. Need to change the CPP line now...

Edit2-
Hmm, looking in /opt/open2x I don't seem to have any g++ binaries, arm or otherwise. Did something go wrong in the open2x build or am I looking in the wrong place?
 
motorollin said:
Ahhh, progress :) When I type that I get:

cygwin-mkdir -p "gp2x"
/bin/sh: cygwin-mkdir: command not found
make: *** [all-before] Error 127


I'm guessing this is because my makefile is from a Windows G++ IDE which must use Cygwin. Is there an example open2x makefile I can use?

Edit-
Think I'm getting there. Copied Makefile.gp2x to Makefile and changed its MKDIR = line to MKDIR=mkdir -p and it gets further now. Need to change the CPP line now...

Edit2-
Hmm, looking in /opt/open2x I don't seem to have any g++ binaries, arm or otherwise. Did something go wrong in the open2x build or am I looking in the wrong place?



heres a make from guyfawkes SDL demo app:
CODE


CROSS_COMPILE = C:/devkitGP2X/bin/arm-linux-
SDL_BASE = C:/devkitGP2X/bin/arm-linux-
LDFLAGS = -static

CC = $(CROSS_COMPILE)gcc
CXX = $(CROSS_COMPILE)g++
STRIP = $(CROSS_COMPILE)strip

CFLAGS = `$(SDL_BASE)sdl-config --cflags` -O2 -Wall -Werror
CXXFLAGS = `$(SDL_BASE)sdl-config --cflags` -O2 -Wall -Werror
LIBS = `$(SDL_BASE)sdl-config --libs`

SDLTEST_TARGET = demo.gpe
SDLTEST_OBJS = demo.o

all : $(SDLTEST_TARGET)

$(SDLTEST_TARGET) : $(SDLTEST_OBJS)
$(CXX) $(LDFLAGS) -o $(SDLTEST_TARGET) $(SDLTEST_OBJS) $(LIBS)
$(STRIP) $(SDLTEST_TARGET)

clean:
rm -f $(ALL_TARGETS) *.o *~



the exe's should be in open2x\bin
 
Last edited by a moderator:
Back
Top