Compiling with Microsoft Visual C++
Introduction
This how-to will explain how to compile Kingpin's GAMEX86.DLL with Visual C++ 6.0 mainly.
Microsoft Developer Studio 6.0 was used to create Kingpin SDK code.
Compiling the DLL is quite simple(one key press), however, setting up the project in VC++ is a little bit more complicated.
Open the Default project
- Download and unzip install/somewhere the Kingpin SDK.
- Open GAME.DSW or GAME.DSP with Visual C++
- You already should be able to compile it, with the F7 key or Menu; Build->Build gamex86.dll
- If you don't see that options you need to make project first active Menu; Build->Set Active Configuration->game - Win32 Release->OK or you can use the Build->Batch Build.
- If it's compiles and you get a error:
LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:library
You can fix that by adding /nodefaultlib:"LIBC" to the compiler at:
Menu; Project->Settings or Alt+F7 then Link tab and then at Project Options just at somewhere at the compiler best probably after /machine:I386 /nodefaultlib:"LIBC" and the error should be gone.
Creating a New Project
First, we must create the project in which we are going to work:
- Start Visual C++ 6.0
- Close any open Workspaces
- Choose New from the File menu
- Select the Projects tab and highlight the "Win32 Dynamic-Link Library"
- Click in the Project name entry and type a name for your project
- Check the Location and make sure it's correct
- Make sure the radio button for Create new Workspace is checked
- Under Platforms, make sure Win32 is checked then click OK
- A new Window will popup "What king of DLL would you like to create?"
Choose: An empty DLL project. and then click Finish
Adding Files to the New Project
Now that we have our project and workspace, we need to add id's Kingpin SDK source files to the project.
- Create a new folder in your project directory called "Source"
- Copy the Kingpin source files to this directory
- Under the menu Project->Add To Project->Files.
- Change to the source directory you just created
- Under Files of type choose All Files (*.*) make sure it's all files otherwise GAME.DEF will be missing (Without GAME.DEF it will compile and no error but the gamex86.dll won't work)
- Select all of the files that appear in the window and click OK
Fixing the Compiler
There still some things missing from the compiler the Kingpin SDK. Kingpin needs NavLib.lib otherwise it won't compile. To make sure the compiler is set to release:
- Under menu; Build->Set Active Configuration->game - Win32 Release->OK
To add Navlib.lib:
- Under menu; Project->Settings...
- Tab Link and then under Object Libary Modules add NavLib\NavLib.lib or the correct location of Navlib.lib from the Kingpin SDK source files for example: ..\NavLib\NavLib.lib if it's a directory lower.
- If there other lib files just remove them there not nessarcy and can give problems the only lib files you can use are: navlib\navlib.lib kernel32.lib user32.lib winmm.lib
- Also vink Doesn't Produce .LIB on and click OK
To fix the error:
LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:library
- Under menu; Project->Settings...
- Tab Link and then change Category to Input
- Now you see a new option and add LIBC to Ignore Libraries and press the OK button
To compile the DLL with the correct name and the correct folder for example in game folder of Kingpin:
- Under menu; Project->Settings...
- Tab Link and then change output filename to the game folder for example
c:\games\kingpin\mod\gamex86.dll - and click OK
Download project file
Microsoft Visual 6.0 |