r1ch.net forums
* Home Help Search Login Register
r1ch.net  |  r1ch.net stuff  |  R1Q2  |  Topic: Compiling your r1q2 from source on WIN32
Pages: 1 [2] 3 4  All
Print
Author Topic: Compiling your r1q2 from source on WIN32  (Read 47968 times)
neveride
Member

Posts: 26


« Reply #15 on: July 16, 2008, 01:39:35 pm »

There I have kernel32.lib, so no typos in the project. I have no idea why I made such a typo in my post - strange. I cleaned and tried to rebuild many times, but it happens all over again...

...
...many warnings regarding deprecated declarations....and then...
...

Generating Code...
Compiling resources...
Linking...
sys_win.obj : error LNK2019: unresolved external symbol _IsDebuggerPresent referenced in function _Sys_Error
./build/binaries/release/r1q2.exe : fatal error LNK1120: 1 unresolved externals
Build log was saved at "file://c:\Documents and Settings\Michal\Moje dokumenty\Visual Studio 2005\Projects\R1Q2 src\build\temp\r1q2\release\BuildLog.htm"
quake2 - 2 error(s), 332 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Logged
mhanor
Member

Posts: 120


« Reply #16 on: July 16, 2008, 02:07:57 pm »

search the x86 kernel32.lib on your hdd (it comes with the Windows SDK) and make sure that path is included in the "Additional library directories" project option

or maybe you should reinstall the Windows SDK
Logged
R1CH
Administrator
Member

Posts: 2625



« Reply #17 on: July 16, 2008, 02:25:53 pm »

Make sure your SDK is set for Win98 or higher, I think the first version of Win95 didn't have that API, so the SDK requires some setting to enable more modern functions.
Logged
neveride
Member

Posts: 26


« Reply #18 on: July 16, 2008, 04:10:50 pm »

I reinstalled DirectX SDK and VS 2005 SDK. I added all the paths to include/lib. Linker files were already there. Error is still the same. I don't know what you mean rich by setting my SDK for Win98 or higher, but I think that it would be set by default nowadays. My problem is permanent, I think I will just have to wait till rich adds features, that I'm interested in, to his client.
Greets,
Nev.
Logged
R1CH
Administrator
Member

Posts: 2625



« Reply #19 on: July 16, 2008, 04:15:07 pm »

Stop installing the VS2005 SDK, that's for making Visual Studio addons. You need the Platform SDK.

http://www.microsoft.com/downloads/details.aspx?FamilyID=e6e1c3df-a74f-4207-8586-711ebe331cdc&DisplayLang=en
Logged
QwazyWabbit
Member

Posts: 402


« Reply #20 on: July 16, 2008, 07:44:49 pm »

I can confirm this is a problem in VC++ 6.0 Enterprise Edition when attempting RELEASE build with the Platform SDK installed correctly.

I downloaded and extracted the source archive: r1q2-b7759-src.zip
Opened the project with VC6, set project to quake2, debug build and built r1q2.exe.
Obtained the usual warnings and the following link errors:
unzip.obj : error LNK2001: unresolved external symbol _fill_fopen_filefunc
files.obj : error LNK2001: unresolved external symbol _unzGoToNextFile
files.obj : error LNK2001: unresolved external symbol _unzGetOffset
files.obj : error LNK2001: unresolved external symbol _unzGetCurrentFileInfo
files.obj : error LNK2001: unresolved external symbol _unzGoToFirstFile
files.obj : error LNK2001: unresolved external symbol _unzGetGlobalInfo
files.obj : error LNK2001: unresolved external symbol _unzOpen
snd_win.obj : error LNK2001: unresolved external symbol _DirectSoundCreate@12

Hunting down the errors and fixed them:
Added qcommon\ioapi.c to the quake2 debug and release projects to fix missing _fill_fopen_filefunc
Added qcommon\unzip.c to the quake2 debug and release projects to fix missing _unz*
Added linkage to dsound.lib for debug and release mode projects to fix _DirectSoundCreate

Build in Debug mode successfully compiles and links.
Build in Release mode yields good compile but bad linkage:
Linking...
sys_win.obj : error LNK2001: unresolved external symbol _IsDebuggerPresent
./build/binaries/release/r1q2.exe : fatal error LNK1120: 1 unresolved externals

With VC++ 2008 Express Edition can't get past the q2.rc file. If fails with:
1>------ Build started: Project: quake2, Configuration: Debug Win32 ------
1>Compiling resources...
1>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
1>Copyright (C) Microsoft Corporation.  All rights reserved.
1>.\win32\q2.rc(10) : fatal error RC1015: cannot open include file 'afxres.h'.

What's even more interesting is that I have a b6557 project in VC6 that works in both modes that I have been using for quite a while and it refers to the IsDebuggerPresent function in the same way.

Still looking into this. If I find the difference I will post more.
« Last Edit: July 16, 2008, 07:52:17 pm by QwazyWabbit » Logged
neveride
Member

Posts: 26


« Reply #21 on: July 18, 2008, 06:18:10 am »

Thanks R1ch, Platform SDK solved a problem. But I also need libraries and headers from Direct X SDK, so it's also needed, aye? After compilation, my binary takes only 468kB (yours is 763kB) and it requires zlib1.dll in the game folder in order to run (and I can't connect to any server on the Internet anyway, so it is useless). I suppose that in your version dll file is somehow incorporated in the binary. How can I do it? Maybe it's a lame question, but they did not teach us this in school Wink.
Thanks for your help.
Logged
neveride
Member

Posts: 26


« Reply #22 on: July 25, 2008, 10:24:44 am »

OK, I've got no response so probably nobody understand what I mean. I will describe the problem and I hope that you will be able to help me.
When I compile it, it has 600kB (I changed project->properties->configuration properties->c/c++->code generation to multi-threaded (MT), because I thought it would help me compile the binary with statical libraries, so I don't have to copy zlib1.dll to the quake2 dir - I have to do this anyway).

When I type map q2dm1 I see this message 2 times:
deflateInit2() failed.

In R1ch's code I found:

   if (deflateInit2 (&z, Z_DEFAULT_COMPRESSION, Z_DEFLATED, -15, 9, Z_DEFAULT_STRATEGY) != Z_OK)
   {
      SV_ClientPrintf (sv_client, PRINT_HIGH, "deflateInit2() failed.\n");
      goto plainLines;
   }

This if is tested only if here:

   #ifndef NO_ZLIB
      if (sv_client->protocol == PROTOCOL_ORIGINAL)
   #endif
      {
   #ifndef NO_ZLIB

...we have false.

R1ch's binary does not require zlib1.dll in q2 dir, so taking into account that mine does need it and also the problem that I encounter is related to zlib, I think that I have to make my compilator statically compile the library, so there is no dll needed. Am I wrong? How can I do this? Maybe there are some other ideas?

I will gladly hear what you all have to say Smiley

Greets,
Nev.



« Last Edit: July 27, 2008, 06:01:57 am by neveride » Logged
neveride
Member

Posts: 26


« Reply #23 on: September 15, 2008, 01:48:23 pm »

Okay, once again me.
After "format C:" I decided to try again. I installed Visual Studio 6.0 this time and platform sdk for xp sp2 (that's my system). I added everything needed to the linker and to the directories. Everything compiles just fine, when I do it in debug mode. The problem is that executable asks me for zlib1.dll. When I take it from zlib directory and put it to q2 directory. When I try to connect to any server, quake2 crashes. This is the info from a debug mode (I didn't put disasembly):


Loaded 'D:\Gry\Q2_r1q2\nevr1q2.exe', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\ntdll.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\user32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\gdi32.dll', no matching symbolic information found.
Loaded 'D:\Gry\Q2_r1q2\zlib1.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\msvcrt.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\dinput8.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\advapi32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\rpcrt4.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\secur32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\dsound.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\ole32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\winmm.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\version.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\wsock32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\ws2_32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\ws2help.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\imm32.dll', no matching symbolic information found.
Loaded 'D:\Gry\Q2_r1q2\ref_r1gl.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\opengl32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\glu32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\ddraw.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\dciman32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\uxtheme.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\MSCTF.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\MSCTFIME.IME', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\atioglxx.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\wintrust.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\crypt32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\msasn1.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\imagehlp.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\wdmaud.drv', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\msacm32.drv', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\msacm32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\midimap.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\ksuser.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\hid.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\setupapi.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\oleaut32.dll', no matching symbolic information found.
Loaded 'C:\Program Files\NetLimiter\nl_lsp.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\nl_msgc.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\shlwapi.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\mswsock.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\hnetcfg.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\wshtcpip.dll', no matching symbolic information found.
Loaded 'D:\Gry\Q2_r1q2\dbghelp.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\apphelp.dll', no matching symbolic information found.
The thread 0xB94 has exited with code 0 (0x0).
The program 'D:\Gry\Q2_r1q2\nevr1q2.exe' has exited with code 0 (0x0).

I have a bigger problem when I try to compile in release mode (as r1ch suggests). I get the following error:

--------------------Configuration: quake2 - Win32 Release--------------------
Compiling resources...
Compiling...
alw_win.c
cd_win.c
cl_cin.c
cl_dll.c
cl_ents.c
cl_fx.c
cl_input.c
cl_inv.c
cl_main.c
cl_newfx.c
cl_parse.c
cl_pred.c
cl_scrn.c
cl_tent.c
cl_view.c
cmd.c
cmodel.c
common.c
conproc.c
console.c
crc.c
cvar.c
files.c
in_win.c
ioapi.c
keys.c
le_physics.c
le_util.c
m_flash.c
md4.c
menu.c
mersennetwister.c
net_chan.c
net_wins.c
C:\Documents and Settings\Michal\Moje dokumenty\Projects\R1Q2\win32\net_wins.c(502) : warning C4514: 'Int64ShllMod32' : unreferenced inline function has been removed
        C:\Program Files\Microsoft Platform SDK for Windows XP SP2\Include\winnt.h(606) : see declaration of 'Int64ShllMod32'
C:\Documents and Settings\Michal\Moje dokumenty\Projects\R1Q2\win32\net_wins.c(502) : warning C4514: 'Int64ShraMod32' : unreferenced inline function has been removed
        C:\Program Files\Microsoft Platform SDK for Windows XP SP2\Include\winnt.h(613) : see declaration of 'Int64ShraMod32'
C:\Documents and Settings\Michal\Moje dokumenty\Projects\R1Q2\win32\net_wins.c(502) : warning C4514: 'Int64ShrlMod32' : unreferenced inline function has been removed
        C:\Program Files\Microsoft Platform SDK for Windows XP SP2\Include\winnt.h(620) : see declaration of 'Int64ShrlMod32'
C:\Documents and Settings\Michal\Moje dokumenty\Projects\R1Q2\win32\net_wins.c(502) : warning C4514: 'GetFiberData' : unreferenced inline function has been removed
        C:\Program Files\Microsoft Platform SDK for Windows XP SP2\Include\winnt.h(1954) : see declaration of 'GetFiberData'
C:\Documents and Settings\Michal\Moje dokumenty\Projects\R1Q2\win32\net_wins.c(502) : warning C4514: 'GetCurrentFiber' : unreferenced inline function has been removed
        C:\Program Files\Microsoft Platform SDK for Windows XP SP2\Include\winnt.h(1959) : see declaration of 'GetCurrentFiber'
C:\Documents and Settings\Michal\Moje dokumenty\Projects\R1Q2\win32\net_wins.c(502) : warning C4514: 'RtlSecureZeroMemory' : unreferenced inline function has been removed
        C:\Program Files\Microsoft Platform SDK for Windows XP SP2\Include\winnt.h(7724) : see declaration of 'RtlSecureZeroMemory'
pmove.c
q_shared.c
q_shwin.c
qal_win.c
qmenu.c
redblack.c
snd_dma.c
snd_mem.c
snd_mix.c
snd_win.c
sv_ccmds.c
sv_ents.c
sv_game.c
sv_init.c
sv_main.c
sv_send.c
sv_user.c
sv_world.c
sys_win.c
C:\Documents and Settings\Michal\Moje dokumenty\Projects\R1Q2\win32\sys_win.c(168) : warning C4013: 'IsDebuggerPresent' undefined; assuming extern returning int
unzip.c
C:\Documents and Settings\Michal\Moje dokumenty\Projects\R1Q2\win32\sys_win.c(2327) : warning C4761: integral size mismatch in argument; conversion supplied
C:\Documents and Settings\Michal\Moje dokumenty\Projects\R1Q2\win32\sys_win.c(2423) : warning C4761: integral size mismatch in argument; conversion supplied
vid_dll.c
vid_menu.c
Linking...
sys_win.obj : error LNK2001: unresolved external symbol _IsDebuggerPresent
./build/binaries/release/quake2.exe : fatal error LNK1120: 1 unresolved externals

Error executing link.exe.

quake2.exe - 2 error(s), 9 warning(s)

_IsDebuggerPresent is a function from kernel32.lib. It is added to the linker and the directory where it is placed is also added to lib directories (it is a file from platform sdk). Why do I keep getting this error, if kernel32.lib is there? Why does it compile in debug mode and does not compile in release mode?

Logged
R1CH
Administrator
Member

Posts: 2625



« Reply #24 on: September 15, 2008, 04:08:47 pm »

The IsDebuggerPresent is not present in debug builds due to an ifdef.
Logged
neveride
Member

Posts: 26


« Reply #25 on: September 15, 2008, 04:56:02 pm »

that explains why it compiles in debug mode. why do i get this error while building in release mode (I have all the prerequisities). Moreover, why does it ask for zlib1.dll all the time?
Logged
R1CH
Administrator
Member

Posts: 2625



« Reply #26 on: September 15, 2008, 05:59:47 pm »

You need to static link with zlib if you don't want the DLL dependencies.
Logged
neveride
Member

Posts: 26


« Reply #27 on: September 16, 2008, 05:01:12 am »

1. How do I do this in VS 6.0? I went to project -> settings -> c/c++ -> code generation -> use run-time library. I checked all the possibilities and it still requires zlib1.dll.

2. What's wrong with this _IsDebuggerPresent? kernel32.lib is linked, so what can be wrong there? (I link with: user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib zlib.lib dinput8.lib dsound.lib dxguid.lib wsock32.lib winmm.lib) The error is:

--------------------Configuration: quake2 - Win32 Release--------------------
Compiling resources...
Compiling...
alw_win.c
cd_win.c
cl_cin.c
cl_dll.c
cl_ents.c
cl_fx.c
cl_input.c
cl_inv.c
cl_main.c
cl_newfx.c
cl_parse.c
cl_pred.c
cl_scrn.c
cl_tent.c
cl_view.c
cmd.c
cmodel.c
common.c
conproc.c
console.c
crc.c
cvar.c
files.c
in_win.c
ioapi.c
keys.c
le_physics.c
le_util.c
m_flash.c
md4.c
menu.c
mersennetwister.c
net_chan.c
net_wins.c
C:\Documents and Settings\Michal\Moje dokumenty\Projects\R1Q2\win32\net_wins.c(502) : warning C4514: 'Int64ShllMod32' : unreferenced inline function has been removed
        C:\Program Files\Microsoft Platform SDK for Windows XP SP2\Include\winnt.h(606) : see declaration of 'Int64ShllMod32'
C:\Documents and Settings\Michal\Moje dokumenty\Projects\R1Q2\win32\net_wins.c(502) : warning C4514: 'Int64ShraMod32' : unreferenced inline function has been removed
        C:\Program Files\Microsoft Platform SDK for Windows XP SP2\Include\winnt.h(613) : see declaration of 'Int64ShraMod32'
C:\Documents and Settings\Michal\Moje dokumenty\Projects\R1Q2\win32\net_wins.c(502) : warning C4514: 'Int64ShrlMod32' : unreferenced inline function has been removed
        C:\Program Files\Microsoft Platform SDK for Windows XP SP2\Include\winnt.h(620) : see declaration of 'Int64ShrlMod32'
C:\Documents and Settings\Michal\Moje dokumenty\Projects\R1Q2\win32\net_wins.c(502) : warning C4514: 'GetFiberData' : unreferenced inline function has been removed
        C:\Program Files\Microsoft Platform SDK for Windows XP SP2\Include\winnt.h(1954) : see declaration of 'GetFiberData'
C:\Documents and Settings\Michal\Moje dokumenty\Projects\R1Q2\win32\net_wins.c(502) : warning C4514: 'GetCurrentFiber' : unreferenced inline function has been removed
        C:\Program Files\Microsoft Platform SDK for Windows XP SP2\Include\winnt.h(1959) : see declaration of 'GetCurrentFiber'
C:\Documents and Settings\Michal\Moje dokumenty\Projects\R1Q2\win32\net_wins.c(502) : warning C4514: 'RtlSecureZeroMemory' : unreferenced inline function has been removed
        C:\Program Files\Microsoft Platform SDK for Windows XP SP2\Include\winnt.h(7724) : see declaration of 'RtlSecureZeroMemory'
pmove.c
q_shared.c
q_shwin.c
qal_win.c
qmenu.c
redblack.c
snd_dma.c
snd_mem.c
snd_mix.c
snd_win.c
sv_ccmds.c
sv_ents.c
sv_game.c
sv_init.c
sv_main.c
sv_send.c
sv_user.c
sv_world.c
sys_win.c
C:\Documents and Settings\Michal\Moje dokumenty\Projects\R1Q2\win32\sys_win.c(168) : warning C4013: 'IsDebuggerPresent' undefined; assuming extern returning int
unzip.c
C:\Documents and Settings\Michal\Moje dokumenty\Projects\R1Q2\win32\sys_win.c(2327) : warning C4761: integral size mismatch in argument; conversion supplied
C:\Documents and Settings\Michal\Moje dokumenty\Projects\R1Q2\win32\sys_win.c(2423) : warning C4761: integral size mismatch in argument; conversion supplied
vid_dll.c
vid_menu.c
Linking...
sys_win.obj : error LNK2001: unresolved external symbol _IsDebuggerPresent
./build/binaries/release/quake2.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

quake2.exe - 2 error(s), 9 warning(s)
Logged
neveride
Member

Posts: 26


« Reply #28 on: September 16, 2008, 05:04:25 am »

there is also kernel32.lib in the linker (jsut in the begining), somehow it didn't copy...
Logged
QwazyWabbit
Member

Posts: 402


« Reply #29 on: September 16, 2008, 11:57:42 pm »

You need to download the zlib package: http://www.zlib.net/ and use the .lib linkage to incorporate zlib with the project. This is a separate package from the r1q2 project. You can use the zlib package in other projects as well, but that's another story. You can use the delivered .lib and .dll or recompile them on your computer.
Logged
Pages: 1 [2] 3 4  All
Print
r1ch.net  |  r1ch.net stuff  |  R1Q2  |  Topic: Compiling your r1q2 from source on WIN32
Jump to:  

Powered by SMF 1.1.19 | SMF © 2013, Simple Machines