1 (edited by Xudo 2014-12-06 19:45:37)

Topic: Compiling teeworlds 0.6.3 Win7 MS VS 2010

My goal is to compile teeworlds client using MSVS.
I'm not experienced in Python or bam, thats why I have chosen my regular IDE.
I have created a project for teeworlds and succesfully handle SDL and freetype additional libraries.
Now I stuck with error (70 ones) saying

error LNK2019: unresolved external __imp__glDeleteTextures@8 in function "private: void __thiscall CCommandProcessorFragment_OpenGL::Cmd_Texture_Destroy(struct CCommandBuffer::SCommand_Texture_Destroy const *)" (?Cmd_Texture_Destroy@CCommandProcessorFragment_OpenGL@@AAEXPBUSCommand_Texture_Destroy@CCommandBuffer@@@Z)    $(SourceDir)\teeworlds\teeworlds\backend_sdl.obj

As far as I know, I need to find OpenGL libraries and add path to project properties. But OpenGL should be shipped with my OS.
What OpenGL libraries are teeworlds using?

2

Re: Compiling teeworlds 0.6.3 Win7 MS VS 2010

The library you are searching for is 'opengl32' (probably also need 'glu32')
The .lib files are actually part of the Windows SDK

3

Re: Compiling teeworlds 0.6.3 Win7 MS VS 2010

You are right about openGL32 and glu32 libs.

Now 2 errors left.

error LNK2019: unresolved externals "public: __thiscall CGameConsole::CGameConsole(void)" (??0CGameConsole@@QAE@XZ) in function "void __cdecl `dynamic initializer for 'gs_GameConsole''(void)" (??__Egs_GameConsole@@YAXXZ)    $(SourceDir)\teeworlds\teeworlds\gameclient.obj

error LNK2019: unresolved externals "public: void __thiscall CGameConsole::PrintLine(int,char const *)" (?PrintLine@CGameConsole@@QAEXHPBD@Z) in function "public: virtual void __thiscall CGameClient::OnRconLine(char const *)" (?OnRconLine@CGameClient@@UAEXPBD@Z)    $(SourceDir)\teeworlds\teeworlds\gameclient.obj

Files console.h, console.cpp are included in project.
It probably comes from the fact, that gs_GameConsole is a static member without strict definition, but I'm not sure.

4

Re: Compiling teeworlds 0.6.3 Win7 MS VS 2010

Hm, not sure
There should be two "console.h"/"console.cpp" as there is one in /engine and one in /game/client/component, maybe you are missing the 2nd ones

5

Re: Compiling teeworlds 0.6.3 Win7 MS VS 2010

Delete the obj folder and try again.

How to database by FFanta: http://puu.sh/jdPVk/fa37a95ac2.png

6

Re: Compiling teeworlds 0.6.3 Win7 MS VS 2010

I have figured out the problem.
MSVS by default flatten folder structure for .obj files. As long as there was two console.h files, it tried to make two "console.obj" files in same directory. This situation produces " LNK2019 unresolved externals" error and "LNK4042: object specified more than once; extras ignored" warning.

When I have searched information about (unknown at a time) LNK4042 warning I found a solution in this stackoverflow thread.

The solution is simple. You need to edit the properties for the entire project, and the change the value under C/C++ -> Output Files -> "Object File Name" to be the following:
$(IntDir)/%(RelativeDir)/

7

Re: Compiling teeworlds 0.6.3 Win7 MS VS 2010

Thanks for sharing the solution!

8 (edited by Xudo 2014-12-10 22:18:09)

Re: Compiling teeworlds 0.6.3 Win7 MS VS 2010

I have polished solution a bit. Here is project files.
Unzip it in "teeworlds-0.6.3-src". Path to solution is expected to be "teeworlds-0.6.3-src\projectfiles\VC10\teeworlds.sln".
If you build this solution in Release configuration you will get a folder in "teeworlds-0.6.3-src\projectfiles\" with ready to use client executables.
Though, I have failed to find an original icon.