How to compile and debug ddnet on Windows in Visual Studio

Guides about mapping and everything Teeworlds related.

milk
User
Posts: 207
Joined: Mon May 05, 2014 5:25 pm
Player profile: milk

How to compile and debug ddnet on Windows in Visual Studio

Post by milk » Tue Jan 19, 2016 7:51 am

How to compile and debug ddnet on Windows in Visual Studio
written by milk

There are already some teeworlds compiling tutorials for Windows (1, 2) but they are a bit outdated and not really friendly for newcomers with not quite good programming skills. I tried to make my own tutorial based on these but more extended and intuitive.
I hope this tutorial will help someone and save some time.
  • Let's start.
    You'll need Windows 7,8 or 10, 32/64 bit. Probably it should work on Windows XP SP3 too.

    1. Install Visual Studio 2. Get ddnet sources
    • 2.1 Download archive with ddnet sources from https://github.com/ddnet/ddnet using "Download zip" button.
      2.2 Extract it wherever you want (For example to "C:\ddnet\"). This is will be your project directory.
      SpoilerShow
      scr1.png
    3. Install Python 4. Compile and install bam
    • 4.1 Download bam from https://github.com/matricks/bam using "Download zip" button.
      4.2 Extract it wherever you want (For example to "C:\bam\").
      4.3 Execute the file make_win32_msvc.bat, bam will compile itself.
      4.4 Copy the compiled file bam.exe to your project directory (For example to "C:\ddnet\").
    5. Setup Visual Studio project
    • 5.1 Download ddnet_visual_studio_project.zip and extract it to your project directory (For example to "C:\ddnet\").
      ddnet_visual_studio_project.zip
      (2.07 KiB) Downloaded 275 times
      5.2 Run the file ddnet.sln and Visual Studio will open your project.
      5.3 Press button "Show all files", right click on "src" folder and press "Include In Project".
      SpoilerShow
      scr2.png
      scr2.png (31.15 KiB) Viewed 3072 times
      5.4 Now you can start to edit sources, compile and debug! There are 6 project configurations:
      SpoilerShow
      scr3.png
      scr3.png (29.91 KiB) Viewed 3074 times
      • 5.4.1 Select client_release or server_release and press Debug->Build Solution in menu (or F7) to build client or server releases.
        If everything is ok, compiled files will appear in your project directory.
        5.4.2 Select client_debug or server_debug and press Debug->Start Debugging in menu (or F5) to compile and start debugging client or server.
        SpoilerShow
        scr4.png
      5.5 (Optional) If you want to compile server_sql_release or server_sql_debug, you need to:
If you have some questions, suggestions or remarks, post them in this topic.
Last edited by milk on Tue Jan 19, 2016 9:45 pm, edited 4 times in total.

milk
User
Posts: 207
Joined: Mon May 05, 2014 5:25 pm
Player profile: milk

Re: How to compile and debug ddnet on Windows in Visual Studio

Post by milk » Tue Jan 19, 2016 8:42 am

FAQ:
  • Q: I got compilation error in Visual Studio 2010:
    • LNK1123: failure during conversion to COFF: file invalid or corrupt
    A: There is a simple solution:
    Just remove or rename file "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cvtres.exe"
    Here is explanation why is it so: http://stackoverflow.com/a/14144713/5720164
    Now clean the project and try to compile again.
    SpoilerShow
    scr7.png
    scr7.png (21.67 KiB) Viewed 2962 times
Last edited by milk on Tue Jan 19, 2016 9:37 pm, edited 1 time in total.

User avatar
kamillentee
User
Posts: 687
Joined: Sat Jul 26, 2014 11:47 pm
Player profile: kamillentee
Clan: |*KoG*|

Re: How to compile and debug ddnet on Windows in Visual Studio

Post by kamillentee » Tue Jan 19, 2016 4:00 pm

good work!

HMH
Technical Team: Team Leader
Posts: 146
Joined: Mon May 05, 2014 8:41 pm
Player profile: HMH

Re: How to compile and debug ddnet on Windows in Visual Studio

Post by HMH » Tue Jan 19, 2016 6:07 pm

Very nice work ! There is just a tiny thing you should definitely change: https://matricks.github.io/bam/ indeed offers bam-0.4. The problem is that the script thats builds bam does not support any Visual Studio version beyond Visual Studio 10. The download there is simply outdated. Instead use: https://github.com/matricks/bam/archive/master.zip

User avatar
Ryozuki
User
Posts: 1712
Joined: Tue Feb 24, 2015 7:28 am
Location: Catalonia
Player profile: Ryozuki
Mapper profile: Ryozuki
Clan: Unique

Re: How to compile and debug ddnet on Windows in Visual Studio

Post by Ryozuki » Tue Jan 19, 2016 6:27 pm

would be cool if you add that info on the wiki :)

milk
User
Posts: 207
Joined: Mon May 05, 2014 5:25 pm
Player profile: milk

Re: How to compile and debug ddnet on Windows in Visual Studio

Post by milk » Tue Jan 19, 2016 8:36 pm

HMH wrote:Very nice work ! There is just a tiny thing you should definitely change: https://matricks.github.io/bam/ indeed offers bam-0.4. The problem is that the script thats builds bam does not support any Visual Studio version beyond Visual Studio 10. The download there is simply outdated. Instead use: https://github.com/matricks/bam/archive/master.zip
Thank you! Fixed.
Ryozuki wrote:would be cool if you add that info on the wiki
Oh, I forgot about wiki. I'll add this later.

pixel
User
Posts: 430
Joined: Sun Nov 22, 2015 8:44 pm
Player profile: pixel
Mapper profile: pixel
Clan: Bitfighter

Re: How to compile and debug ddnet on Windows in Visual Studio

Post by pixel » Sat Oct 15, 2016 1:28 pm

Question: Is there a ddnet_visual_studio_project.zip for normal teeworlds? like teeworlds_visual_studio_project.zip????

User avatar
justafish
User
Posts: 58
Joined: Sun Dec 18, 2016 7:49 pm
Location: Sweden
Player profile: Just%20a%20fish

Re: How to compile and debug ddnet on Windows in Visual Studio

Post by justafish » Thu Apr 06, 2017 9:38 pm

I have been trying to follow this guide, but I just can't get it to work.
Here is what I get in Visual Studio Express 10.0:
http://pasted.co/aae99a7a

Errors everywhere! Can someone please help me? :/
Smoking kills. If you're killed, you've lost a very important part of your life.

User avatar
deen
Retired Administrator
Posts: 3184
Joined: Mon May 05, 2014 2:30 pm
Player profile: deen

Re: How to compile and debug ddnet on Windows in Visual Studio

Post by deen » Thu Apr 06, 2017 10:13 pm

The C files should be compiled with a C compiler, not with a C++ one. That's all I can tell though, hopefully someone with Visual Studio experience can chime in.

BeaR
User
Posts: 54
Joined: Fri May 30, 2014 10:18 am
Player profile: BeaR

Re: How to compile and debug ddnet on Windows in Visual Studio

Post by BeaR » Fri Apr 07, 2017 1:51 pm

Looks like the scripts for generating the protocol files aren't executed properly. Either call them manually or fix your python setup.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest