Page 1 of 2

How to compile and debug ddnet on Windows in Visual Studio

Posted: Tue Jan 19, 2016 7:51 am
by milk
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
      scr1.png (55.53 KiB) Viewed 14721 times
    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 578 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 14719 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 14721 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
        scr4.png (157.01 KiB) Viewed 14721 times
      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.

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

Posted: Tue Jan 19, 2016 8:42 am
by milk
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 14609 times

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

Posted: Tue Jan 19, 2016 4:00 pm
by kamillentee
good work!

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

Posted: Tue Jan 19, 2016 6:07 pm
by HMH
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

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

Posted: Tue Jan 19, 2016 6:27 pm
by Ryozuki
would be cool if you add that info on the wiki :)

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

Posted: Tue Jan 19, 2016 8:36 pm
by milk
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.

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

Posted: Sat Oct 15, 2016 1:28 pm
by pixel
Question: Is there a ddnet_visual_studio_project.zip for normal teeworlds? like teeworlds_visual_studio_project.zip????

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

Posted: Thu Apr 06, 2017 9:38 pm
by justafish
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? :/

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

Posted: Thu Apr 06, 2017 10:13 pm
by deen
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.

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

Posted: Fri Apr 07, 2017 1:51 pm
by BeaR
Looks like the scripts for generating the protocol files aren't executed properly. Either call them manually or fix your python setup.