.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   HPB_bot (http://forums.bots-united.com/forumdisplay.php?f=35)
-   -   Compiling dlls with MingWing (http://forums.bots-united.com/showthread.php?t=3701)

Beasty 06-03-2005 03:55

Compiling dlls with MingWing
 
When compiling with MingWing in Command Prompt, I get an error. I've set everything up for the patch as Botman said in SDK 2.2 patch. But when I compile the dll, this error comes up (I only wrote the last 3 lines).

.cpp: undefined reference to ' vtable for __cxxabv1::__class_type_info '
dllwrap: gcc exited with status 1
make: *** [mm.dll] Error 1

I haven't modified any of the source code and note that mm.dll is the name of my dll file. But my mod and dlls folder are both empty even after I try to compile. I'm using SDK version 2.3. I'm probably not supposed to use SDK 2.2 patch, but there's no SDK 2.3 patch. The MingWing I'm using came with Dev C++ and I'm using Windows XP Professional. This error comes up when I try to compile any dll file. Suggestions would be greatly appreciated. :(

Whistler 06-03-2005 04:21

Re: Compiling dlls with MingWing
 
change "gcc" to "g++" in makefile. gcc is C compiler and g++ is C++ compiler.

also I advise you using this version of MinGW instead of that one comes with Dev-C++:
http://prdownloads.sourceforge.net/m...1.exe?download

Beasty 06-03-2005 05:35

Re: Compiling dlls with MingWing
 
The error still comes up if I change gcc to g++. I've downloaded MinGWing from that site and installed. I've also created a batch file and changed the directory as botman said, but now command prompt says it does not know what the "make" command means, even after I've loaded the batch file. Here's the contents of the batch file and makefile:

Batch File:
SET MING_DIR=E:\MinGW
PATH=%MING_DIR%\bin;%PATH%
SET GCC_EXEC_PREFIX=%MING_DIR%\lib\gcc-lib\

Make File:
#
# Half-Life Full SDK 2.2 Makefile for MinGW 1.0.1
#
# March 2002 by botman (botman@planethalflife.com)
#
# this is the name of your game MOD DLL file...
DLLNAME=hl
# the following specifies the path to your MOD...
MOD_DIR = E:\SIERRA\Half-Life\my_mod
# make sure this is the correct compiler for your system
CC=gcc
DLL_SRCDIR=.
ENGINE_SRCDIR=..\engine
COMMON_SRCDIR=..\common
WPN_SHARED_SRCDIR=wpn_shared
PM_SHARED_SRCDIR=..\pm_shared
GAME_SHARED_SRCDIR=..\game_shared

DLL_OBJDIR=$(DLL_SRCDIR)\obj
WPN_SHARED_OBJDIR=$(WPN_SHARED_SRCDIR)\obj
PM_SHARED_OBJDIR=$(PM_SHARED_SRCDIR)\obj
GAME_SHARED_OBJDIR=$(GAME_SHARED_SRCDIR)\obj
BASE_CFLAGS=-DCLIENT_WEAPONS
# safe optimization...
CFLAGS=$(BASE_CFLAGS) -w -m486 -O1
# full optimization...
#CFLAGS=$(BASE_CFLAGS) -w -m486 -O2 -Os -ffast-math -funroll-loops \
-fomit-frame-pointer -fexpensive-optimizations \
-malign-loops=2 -malign-jumps=2 -malign-functions=2
# use these when debugging...
#CFLAGS=$(BASE_CFLAGS) -g
INCLUDEDIRS=-I. -I$(ENGINE_SRCDIR) -I$(COMMON_SRCDIR) -I$(PM_SHARED_SRCDIR) -I$(GAME_SHARED_SRCDIR)
# normal linker flags...
LDFLAGS=
# use these when debugging...
#LDFLAGS=
DO_CC=$(CC) $(CFLAGS) $(INCLUDEDIRS) -o $@ -c $<
################################################## ###########################
# SETUP AND BUILD
# GAME
################################################## ###########################
$(DLL_OBJDIR)/%.o: $(DLL_SRCDIR)/%.cpp
$(DO_CC)
$(WPN_SHARED_OBJDIR)/%.o: $(WPN_SHARED_SRCDIR)/%.cpp
$(DO_CC)
$(GAME_SHARED_OBJDIR)/%.o: $(GAME_SHARED_SRCDIR)/%.cpp
$(DO_CC)
$(PM_SHARED_OBJDIR)/%.o: $(PM_SHARED_SRCDIR)/%.c
$(DO_CC)
OBJ = \
$(DLL_OBJDIR)/aflock.o \
$(DLL_OBJDIR)/agrunt.o \
$(DLL_OBJDIR)/airtank.o \
$(DLL_OBJDIR)/animating.o \
$(DLL_OBJDIR)/animation.o \
$(DLL_OBJDIR)/apache.o \
$(DLL_OBJDIR)/barnacle.o \
$(DLL_OBJDIR)/barney.o \
$(DLL_OBJDIR)/bigmomma.o \
$(DLL_OBJDIR)/bloater.o \
$(DLL_OBJDIR)/bmodels.o \
$(DLL_OBJDIR)/bullsquid.o \
$(DLL_OBJDIR)/buttons.o \
$(DLL_OBJDIR)/cbase.o \
$(DLL_OBJDIR)/client.o \
$(DLL_OBJDIR)/combat.o \
$(DLL_OBJDIR)/controller.o \
$(DLL_OBJDIR)/crossbow.o \
$(DLL_OBJDIR)/crowbar.o \
$(DLL_OBJDIR)/defaultai.o \
$(DLL_OBJDIR)/doors.o \
$(DLL_OBJDIR)/effects.o \
$(DLL_OBJDIR)/egon.o \
$(DLL_OBJDIR)/explode.o \
$(DLL_OBJDIR)/flyingmonster.o \
$(DLL_OBJDIR)/func_break.o \
$(DLL_OBJDIR)/func_tank.o \
$(DLL_OBJDIR)/game.o \
$(DLL_OBJDIR)/gamerules.o \
$(DLL_OBJDIR)/gargantua.o \
$(DLL_OBJDIR)/gauss.o \
$(DLL_OBJDIR)/genericmonster.o \
$(DLL_OBJDIR)/ggrenade.o \
$(DLL_OBJDIR)/globals.o \
$(DLL_OBJDIR)/gman.o \
$(DLL_OBJDIR)/h_ai.o \
$(DLL_OBJDIR)/h_battery.o \
$(DLL_OBJDIR)/h_cine.o \
$(DLL_OBJDIR)/h_cycler.o \
$(DLL_OBJDIR)/h_export.o \
$(DLL_OBJDIR)/handgrenade.o \
$(DLL_OBJDIR)/hassassin.o \
$(DLL_OBJDIR)/headcrab.o \
$(DLL_OBJDIR)/healthkit.o \
$(DLL_OBJDIR)/hgrunt.o \
$(DLL_OBJDIR)/hornet.o \
$(DLL_OBJDIR)/hornetgun.o \
$(DLL_OBJDIR)/houndeye.o \
$(DLL_OBJDIR)/ichthyosaur.o \
$(DLL_OBJDIR)/islave.o \
$(DLL_OBJDIR)/items.o \
$(DLL_OBJDIR)/leech.o \
$(DLL_OBJDIR)/lights.o \
$(DLL_OBJDIR)/maprules.o \
$(DLL_OBJDIR)/monstermaker.o \
$(DLL_OBJDIR)/monsters.o \
$(DLL_OBJDIR)/monsterstate.o \
$(DLL_OBJDIR)/mortar.o \
$(DLL_OBJDIR)/mp5.o \
$(DLL_OBJDIR)/multiplay_gamerules.o \
$(DLL_OBJDIR)/namefunc.o \
$(DLL_OBJDIR)/nihilanth.o \
$(DLL_OBJDIR)/nodes.o \
$(DLL_OBJDIR)/osprey.o \
$(DLL_OBJDIR)/pathcorner.o \
$(DLL_OBJDIR)/plane.o \
$(DLL_OBJDIR)/plats.o \
$(DLL_OBJDIR)/player.o \
$(DLL_OBJDIR)/python.o \
$(DLL_OBJDIR)/rat.o \
$(DLL_OBJDIR)/roach.o \
$(DLL_OBJDIR)/rpg.o \
$(DLL_OBJDIR)/satchel.o \
$(DLL_OBJDIR)/schedule.o \
$(DLL_OBJDIR)/scientist.o \
$(DLL_OBJDIR)/scripted.o \
$(DLL_OBJDIR)/shotgun.o \
$(DLL_OBJDIR)/singleplay_gamerules.o \
$(DLL_OBJDIR)/skill.o \
$(DLL_OBJDIR)/sound.o \
$(DLL_OBJDIR)/soundent.o \
$(DLL_OBJDIR)/spectator.o \
$(DLL_OBJDIR)/squadmonster.o \
$(DLL_OBJDIR)/squeakgrenade.o \
$(DLL_OBJDIR)/subs.o \
$(DLL_OBJDIR)/talkmonster.o \
$(DLL_OBJDIR)/teamplay_gamerules.o \
$(DLL_OBJDIR)/tempmonster.o \
$(DLL_OBJDIR)/tentacle.o \
$(DLL_OBJDIR)/triggers.o \
$(DLL_OBJDIR)/tripmine.o \
$(DLL_OBJDIR)/turret.o \
$(DLL_OBJDIR)/util.o \
$(DLL_OBJDIR)/weapons.o \
$(DLL_OBJDIR)/world.o \
$(DLL_OBJDIR)/xen.o \
$(DLL_OBJDIR)/zombie.o \
$(WPN_SHARED_OBJDIR)/hl_wpn_glock.o \
$(GAME_SHARED_OBJDIR)/voice_gamemgr.o \
$(PM_SHARED_OBJDIR)/pm_debug.o \
$(PM_SHARED_OBJDIR)/pm_math.o \
$(PM_SHARED_OBJDIR)/pm_shared.o

all: $(MOD_DIR)\dlls\$(DLLNAME).dll

$(MOD_DIR)\dlls\$(DLLNAME).dll: $(DLLNAME).dll
copy $(DLLNAME).dll $(MOD_DIR)\dlls\$(DLLNAME).dll /Y

$(DLLNAME).dll: $(DLL_OBJDIR)/null $(WPN_SHARED_OBJDIR)/null \
$(GAME_SHARED_OBJDIR)/null $(PM_SHARED_OBJDIR)/null $(OBJ)
dlltool -z $(DLLNAME)_MinGW.def $(OBJ)
echo DllMain=DllMain@12 >> $(DLLNAME)_MinGW.def
echo GiveFnptrsToDll = GiveFnptrsToDll@8 >> $(DLLNAME)_MinGW.def
dllwrap -s --def $(DLLNAME)_MinGW.def -o $(DLLNAME).dll \
$(OBJ) -mwindows

$(DLL_OBJDIR)/null:
mkdir $(DLL_OBJDIR)
@type nul >$(DLL_OBJDIR)\null
$(WPN_SHARED_OBJDIR)/null:
mkdir $(WPN_SHARED_OBJDIR)
@type nul >$(WPN_SHARED_OBJDIR)\null
$(GAME_SHARED_OBJDIR)/null:
mkdir $(GAME_SHARED_OBJDIR)
@type nul >$(GAME_SHARED_OBJDIR)\null
$(PM_SHARED_OBJDIR)/null:
mkdir $(PM_SHARED_OBJDIR)
@type nul >$(PM_SHARED_OBJDIR)\null
clean:
del $(DLL_OBJDIR)\*.o
del $(WPN_SHARED_OBJDIR)\*.o
del $(GAME_SHARED_OBJDIR)\*.o
del $(PM_SHARED_OBJDIR)\*.o
del $(DLLNAME)_MinGW.def
del $(DLLNAME).dll
spotless: clean
@del $(DLL_OBJDIR)\null
rmdir $(DLL_OBJDIR)
@del $(WPN_SHARED_OBJDIR)\null
rmdir $(WPN_SHARED_OBJDIR)
@del $(GAME_SHARED_OBJDIR)\null
rmdir $(GAME_SHARED_OBJDIR)
@del $(PM_SHARED_OBJDIR)\null
rmdir $(PM_SHARED_OBJDIR)

Thanks for the tips! And you did mean to change the gcc to g++ in the CC section at the beginning, right?

Whistler 06-03-2005 08:23

Re: Compiling dlls with MingWing
 
"And you did mean to change the gcc to g++ in the CC section at the beginning, right?"

No. I mean that use g++ to compile .cpp files, and use gcc to compile C files.
my makefile for HLSDK is like this:
PHP Code:

#
# Half-Life Full SDK 2.2 Makefile for MinGW
#
# March 2002 by botman (botman@planethalflife.com)
# Modified by Wei Mingzhi (whistler_wmz@users.sf.net)
#

# this is the name of your game MOD DLL file...
DLLNAME=hl

# make sure this is the correct compiler for your system
CC=gcc
CPP
=g++

DLL_SRCDIR=.
ENGINE_SRCDIR=../engine
COMMON_SRCDIR
=../common
WPN_SHARED_SRCDIR
=./wpn_shared
PM_SHARED_SRCDIR
=../pm_shared
GAME_SHARED_SRCDIR
=../game_shared

MAIN_OBJDIR
=$(DLL_SRCDIR)/obj
DLL_OBJDIR
=$(DLL_SRCDIR)/obj/dll
WPN_SHARED_OBJDIR
=$(DLL_SRCDIR)/obj/wpn_shared
PM_SHARED_OBJDIR
=$(DLL_SRCDIR)/obj/pm_shared
GAME_SHARED_OBJDIR
=$(DLL_SRCDIR)/obj/game_shared

BASE_CFLAGS
=-DCLIENT_WEAPONS

CFLAGS
=$(BASE_CFLAGS) --march=i486 -O2

# use these when debugging...
#CFLAGS=$(BASE_CFLAGS) -g

INCLUDEDIRS=-I. -I$(ENGINE_SRCDIR) -I$(COMMON_SRCDIR) -I$(PM_SHARED_SRCDIR) -I$(GAME_SHARED_SRCDIR)

# normal linker flags...
LDFLAGS=-s

# use these when debugging...
#LDFLAGS=

DO_CC=$(CC) $(CFLAGS) $(INCLUDEDIRS) -$@ -$<
DO_CPP=$(CPP) $(CFLAGS) $(INCLUDEDIRS) -$@ -$<

#############################################################################
# SETUP AND BUILD
# GAME
#############################################################################

$(DLL_OBJDIR)/%.o: $(DLL_SRCDIR)/%.cpp
    
$(DO_CPP)

$(
WPN_SHARED_OBJDIR)/%.o: $(WPN_SHARED_SRCDIR)/%.cpp
    
$(DO_CPP)

$(
GAME_SHARED_OBJDIR)/%.o: $(GAME_SHARED_SRCDIR)/%.cpp
    
$(DO_CPP)

$(
PM_SHARED_OBJDIR)/%.o: $(PM_SHARED_SRCDIR)/%.c
    
$(DO_CC)

OBJ = \
    $(
DLL_OBJDIR)/aflock.\
    $(
DLL_OBJDIR)/agrunt.\
    $(
DLL_OBJDIR)/airtank.\
    $(
DLL_OBJDIR)/animating.\
    $(
DLL_OBJDIR)/animation.\
    $(
DLL_OBJDIR)/apache.\
    $(
DLL_OBJDIR)/barnacle.\
    $(
DLL_OBJDIR)/barney.\
    $(
DLL_OBJDIR)/bigmomma.\
    $(
DLL_OBJDIR)/bloater.\
    $(
DLL_OBJDIR)/bmodels.\
    $(
DLL_OBJDIR)/bullsquid.\
    $(
DLL_OBJDIR)/buttons.\
    $(
DLL_OBJDIR)/cbase.\
    $(
DLL_OBJDIR)/client.\
    $(
DLL_OBJDIR)/combat.\
    $(
DLL_OBJDIR)/controller.\
    $(
DLL_OBJDIR)/crossbow.\
    $(
DLL_OBJDIR)/crowbar.\
    $(
DLL_OBJDIR)/defaultai.\
    $(
DLL_OBJDIR)/doors.\
    $(
DLL_OBJDIR)/effects.\
    $(
DLL_OBJDIR)/egon.\
    $(
DLL_OBJDIR)/explode.\
    $(
DLL_OBJDIR)/flyingmonster.\
    $(
DLL_OBJDIR)/func_break.\
    $(
DLL_OBJDIR)/func_tank.\
    $(
DLL_OBJDIR)/game.\
    $(
DLL_OBJDIR)/gamerules.\
    $(
DLL_OBJDIR)/gargantua.\
    $(
DLL_OBJDIR)/gauss.\
    $(
DLL_OBJDIR)/genericmonster.\
    $(
DLL_OBJDIR)/ggrenade.\
    $(
DLL_OBJDIR)/globals.\
    $(
DLL_OBJDIR)/gman.\
    $(
DLL_OBJDIR)/h_ai.\
    $(
DLL_OBJDIR)/h_battery.\
    $(
DLL_OBJDIR)/h_cine.\
    $(
DLL_OBJDIR)/h_cycler.\
    $(
DLL_OBJDIR)/h_export.\
    $(
DLL_OBJDIR)/handgrenade.\
    $(
DLL_OBJDIR)/hassassin.\
    $(
DLL_OBJDIR)/headcrab.\
    $(
DLL_OBJDIR)/healthkit.\
    $(
DLL_OBJDIR)/hgrunt.\
    $(
DLL_OBJDIR)/hornet.\
    $(
DLL_OBJDIR)/hornetgun.\
    $(
DLL_OBJDIR)/houndeye.\
    $(
DLL_OBJDIR)/ichthyosaur.\
    $(
DLL_OBJDIR)/islave.\
    $(
DLL_OBJDIR)/items.\
    $(
DLL_OBJDIR)/leech.\
    $(
DLL_OBJDIR)/lights.\
    $(
DLL_OBJDIR)/maprules.\
    $(
DLL_OBJDIR)/monstermaker.\
    $(
DLL_OBJDIR)/monsters.\
    $(
DLL_OBJDIR)/monsterstate.\
    $(
DLL_OBJDIR)/mortar.\
    $(
DLL_OBJDIR)/mp5.\
    $(
DLL_OBJDIR)/multiplay_gamerules.\
    $(
DLL_OBJDIR)/namefunc.\
    $(
DLL_OBJDIR)/nihilanth.\
    $(
DLL_OBJDIR)/nodes.\
    $(
DLL_OBJDIR)/osprey.\
    $(
DLL_OBJDIR)/pathcorner.\
    $(
DLL_OBJDIR)/plane.\
    $(
DLL_OBJDIR)/plats.\
    $(
DLL_OBJDIR)/player.\
    $(
DLL_OBJDIR)/python.\
    $(
DLL_OBJDIR)/rat.\
    $(
DLL_OBJDIR)/roach.\
    $(
DLL_OBJDIR)/rpg.\
    $(
DLL_OBJDIR)/satchel.\
    $(
DLL_OBJDIR)/schedule.\
    $(
DLL_OBJDIR)/scientist.\
    $(
DLL_OBJDIR)/scripted.\
    $(
DLL_OBJDIR)/shotgun.\
    $(
DLL_OBJDIR)/singleplay_gamerules.\
    $(
DLL_OBJDIR)/skill.\
    $(
DLL_OBJDIR)/sound.\
    $(
DLL_OBJDIR)/soundent.\
    $(
DLL_OBJDIR)/spectator.\
    $(
DLL_OBJDIR)/squadmonster.\
    $(
DLL_OBJDIR)/squeakgrenade.\
    $(
DLL_OBJDIR)/subs.\
    $(
DLL_OBJDIR)/talkmonster.\
    $(
DLL_OBJDIR)/teamplay_gamerules.\
    $(
DLL_OBJDIR)/tempmonster.\
    $(
DLL_OBJDIR)/tentacle.\
    $(
DLL_OBJDIR)/triggers.\
    $(
DLL_OBJDIR)/tripmine.\
    $(
DLL_OBJDIR)/turret.\
    $(
DLL_OBJDIR)/util.\
    $(
DLL_OBJDIR)/weapons.\
    $(
DLL_OBJDIR)/world.\
    $(
DLL_OBJDIR)/xen.\
    $(
DLL_OBJDIR)/zombie.\
    $(
WPN_SHARED_OBJDIR)/hl_wpn_glock.\
    $(
GAME_SHARED_OBJDIR)/voice_gamemgr.\
    $(
PM_SHARED_OBJDIR)/pm_debug.\
    $(
PM_SHARED_OBJDIR)/pm_math.\
    $(
PM_SHARED_OBJDIR)/pm_shared.o

all
:    $(MAIN_OBJDIR)/$(DLLNAME).dll

$(MAIN_OBJDIR)/$(DLLNAME).dll:    $(DLL_OBJDIR)/dir $(WPN_SHARED_OBJDIR)/dir \
    $(
GAME_SHARED_OBJDIR)/dir $(PM_SHARED_OBJDIR)/dir $(OBJ)
    
dllwrap $(LDFLAGS) --add-stdcall-alias --driver-name=$(CPP) -$(MAIN_OBJDIR)/$(DLLNAME).dll $(OBJ)

$(
MAIN_OBJDIR)/dir:
    -
mkdir $(MAIN_OBJDIR)
    -@echo 
dir >$(MAIN_OBJDIR)/dir

$(DLL_OBJDIR)/dir: $(MAIN_OBJDIR)/dir
    
-mkdir $(DLL_OBJDIR)
    -@echo 
dir >$(DLL_OBJDIR)/dir

$(WPN_SHARED_OBJDIR)/dir: $(MAIN_OBJDIR)/dir
    
-mkdir $(WPN_SHARED_OBJDIR)
    -@echo 
dir >$(WPN_SHARED_OBJDIR)/dir

$(GAME_SHARED_OBJDIR)/dir: $(MAIN_OBJDIR)/dir
    
-mkdir $(GAME_SHARED_OBJDIR)
    -@echo 
dir >$(GAME_SHARED_OBJDIR)/dir

$(PM_SHARED_OBJDIR)/dir: $(MAIN_OBJDIR)/dir
    
-mkdir $(PM_SHARED_OBJDIR)
    -@echo 
dir >$(PM_SHARED_OBJDIR)/dir

clean
:
    -
rm $(DLL_OBJDIR)/*.o
    -rm $(WPN_SHARED_OBJDIR)/*.o
    -rm $(GAME_SHARED_OBJDIR)/*.o
    -rm $(PM_SHARED_OBJDIR)/*.o
    -rm $(MAIN_OBJDIR)/$(DLLNAME).dll 

also if you can't use "make" command, use "mingw32-make" instead.

Beasty 07-03-2005 09:39

Re: Compiling dlls with MingWing
 
The error still comes up. If I use your makefile this error comes up:

makefile:52: *** missing separator. Stop.

Thanks for the help you've given me so far! Can you tell me, in your own words, how to set up the SDK Code for MinGWing? I might have done something wrong.

Pierre-Marie Baty 07-03-2005 15:08

Re: Compiling dlls with MingWing
 
You need to put backslashes "\" at the end of lines that are broken in several sub-parts. The forum code eats them (it's a vBulletin bug, nobody can really do anything about it)

BTW it's "MinGW", not MingWing. It stands for Minimal GNU for Windows.

Beasty 09-03-2005 06:55

Re: Compiling dlls with MingWing
 
Can you send your makefile to me, instead? My email is adhikaria4@yahoo.com.au.

Beasty 10-03-2005 09:35

Re: Compiling dlls with MingWing
 
Whistler? And I can't understand where to put the backslashes.

Whistler 10-03-2005 12:22

Re: Compiling dlls with MingWing
 
put the backslashes after each .o file

Quote:

BTW it's "MinGW", not MingWing. It stands for Minimal GNU for Windows.
well it isn't "Minimal", but "Minimalist GNU for Windows" :)

Beasty 12-03-2005 01:26

Re: Compiling dlls with MingWing
 
Thanks! Sorry, but the error still comes up and I'm having a hard time working out where the backslashes are supposed to be. Could you attach it to an email and send it to me, so that I can try and make the dll properly, whistler?


All times are GMT +2. The time now is 19:34.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.