delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/14/07:25:47

Date: Tue, 14 Oct 1997 13:24:21 +0200 (MET DST)
From: Johan Romin - SP3B <sp95joro AT Katedral DOT SE>
To: djgpp AT delorie DOT com
Subject: HELP WITH MIKMOD NEEDED
Message-ID: <Pine.GSO.3.96.971014131801.5190B-100000@Calcitratus.Katedral.SE>
MIME-Version: 1.0

I need help with mikmod!
The program won't compile...
The strange thing is that when I try to link it to and executable gcc
complains about undefined references, I hope someone knows what i have don
wrong. I have put in the makefile, the output gcc gives me, and the
program that uses mikmod...

	/Johan

---- My Makefile
CC = gcc
CFLAGS = -s -O3 -m486

LOADERS = load_xm.o
DRIVERS = drv_sb.o drv_gus.o
OBJ = mik.cc stars.cc gfxcmd.cc main.cc hplas.cc brain.cc
OBJ2 = virtch.o mloader.o mdriver.o mplayer.o munitrk.o mmio.o mirq.o mdma.o
#OBJ2 = mikmod.o virtch.o mloader.o mdriver.o mplayer.o munitrk.o mmio.o mirq.o mdma.o getopt.o

all:    dem

dem: $(OBJ2) $(LOADERS) $(DRIVERS)
	$(CC) $(CFLAGS) $(OBJ) -o $@ $(LOADERS) $(DRIVERS) $(OBJ2)
------ My gcc output ----
gcc -s -O3 -m486 mik.cc stars.cc gfxcmd.cc main.cc hplas.cc brain.cc -o dem load_xm.o drv_sb.o drv_gus.o virtch.o mloader.o mdriver.o mplayer.o munitrk.o mmio.o mirq.o mdma.o
c:/tools/djgpp/tmp\ccdaaaaa(.text+0x4):mik.cc: undefined reference to `MP_HandleTick(void)'
c:/tools/djgpp/tmp\ccdaaaaa(.text+0x11):mik.cc: undefined reference to `MD_SetBPM(unsigned char)'
c:/tools/djgpp/tmp\ccdaaaaa(.text+0x6d):mik.cc: undefined reference to `ML_RegisterLoader(LOADER *)'
c:/tools/djgpp/tmp\ccdaaaaa(.text+0x77):mik.cc: undefined reference to `MD_RegisterDriver(DRIVER *)'
c:/tools/djgpp/tmp\ccdaaaaa(.text+0x81):mik.cc: undefined reference to `MD_RegisterDriver(DRIVER *)'
c:/tools/djgpp/tmp\ccdaaaaa(.text+0x8b):mik.cc: undefined reference to `MD_RegisterPlayer(void (*)(void))'
c:/tools/djgpp/tmp\ccdaaaaa(.text+0x90):mik.cc: undefined reference to `MD_Init(void)'
c:/tools/djgpp/tmp\ccdaaaaa(.text+0xc6):mik.cc: undefined reference to `ML_LoadFN(char *)'
c:/tools/djgpp/tmp\ccdaaaaa(.text+0xd1):mik.cc: undefined reference to `MP_Init(UNIMOD *)'
c:/tools/djgpp/tmp\ccdaaaaa(.text+0xe3):mik.cc: undefined reference to `MD_PlayStart(void)'
c:/tools/djgpp/tmp\ccdaaaaa(.text+0xf4):mik.cc: undefined reference to `MD_Update(void)'
c:/tools/djgpp/tmp\ccdaaaaa(.text+0x104):mik.cc: undefined reference to `MD_PlayStop(void)'
c:/tools/djgpp/tmp\ccdaaaaa(.text+0x10f):mik.cc: undefined reference to `ML_Free(UNIMOD *)'
c:/tools/djgpp/tmp\ccdaaaaa(.text+0x114):mik.cc: undefined reference to `MD_Exit(void)'
make.exe: *** [dem] Error 1
------ My music routine that won't compile
#include <stdio.h>
#include <dos.h>
#include <crt0.h>
#include "mikmod.h"
#include "wildfile.h"

//int _crt0_startup_flags = _CRT0_FLAG_NEARPTR;

int snd;
UNIMOD *mod;

void tickhandler(void) {
  if(snd==1) {
     MP_HandleTick();    /* play 1 tick of the module */
     MD_SetBPM(mp_bpm);
  }
}

void InitSnd(void) {
   md_mixfreq=44100;
   md_dmabufsize=10000;
   md_mode=DMODE_16BITS|DMODE_STEREO;
   md_device=0;

   ML_RegisterLoader(&load_xm);

   MD_RegisterDriver(&drv_sb);
   MD_RegisterDriver(&drv_gus);

   MD_RegisterPlayer(tickhandler);

   if(!MD_Init()) {
//   if(!snd==1) {
      printf("No soundcard detected\n");
      delay(150);
   }
   else {
      snd=1;
   }
   if(snd==1) {
      mod=ML_LoadFN("mentmelt.xm");
      MP_Init(mod);
      md_numchn=8;
      MD_PlayStart();
   }
}

void UpdateMusic(void) {
   MD_Update();
}

void StopSnd(void) {
  if(snd==1) {
    MD_PlayStop();
    ML_Free(mod);
    MD_Exit();
  }
}

void StartMod(void) {
  if(snd==1) {
  }
}
----

- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019