4.6. Microsoft compiler toolchain (Windows native)

To compile Wireshark on Windows using the Microsoft C/C++ compiler, you’ll need:

  1. C compiler (cl.exe)
  2. Assembler (ml.exe for 32-bit targets and ml64.exe for 64-bit targets)
  3. Linker (link.exe)
  4. Resource Compiler (rc.exe)
  5. C runtime headers and libraries (e.g. stdio.h, msvcrt.lib)
  6. Windows platform headers and libraries (e.g. windows.h, WSock32.lib)
  7. HTML help headers and libraries (htmlhelp.h, htmlhelp.lib)

4.6.1. Official Toolchain Packages And Alternatives

The official Wireshark 2.6.x releases are compiled using Microsoft Visual C++ 2017. The Wireshark 2.4.x releases are compiled using Microsoft Visual C++ 2015. The Wireshark 2.2.x and 2.0.x releases are compiled using Microsoft Visual C++ 2013. The Wireshark 1.12.x and 1.10.x releases were compiled using Microsoft Visual C++ 2010 SP1. The 1.8 releases were compiled using Microsoft Visual C++ 2010 SP1 as well. The 1.6, 1.4, and 1.2 releases were compiled using Microsoft Visual C++ 2008 SP1. Other past releases, including the 1.0 branch, were compiled using Microsoft Visual C++ 6.0.

Using the release compilers is recommended for Wireshark development work.

The older "Express Edition" compilers such as Visual C++ 2010 Express Edition SP1 can be used but any PortableApps packages you create with them will require the installation of a separate Visual C++ Redistributable package on any machine on which the PortableApps package is to be used. See Section 4.6.4, “C-Runtime "Redistributable" Files” below for more details.

However, you might already have a different Microsoft C++ compiler installed. It should be possible to use any of the following with the considerations listed. You will need to sign up for a Visual Studio Dev Essentials account if you don’t have a Visual Studio (MSDN) subscription. The older versions can be downloaded from https://visualstudio.microsoft.com/vs/older-downloads/.

Visual C++ 2015 Community Edition

IDE + Debugger?
Yes
SDK required for 64-bit builds?
No

CMake Generator: Visual Studio 14

You can use Chocolatey to install Visual Studio, e.g:

PS:\> choco install VisualStudioCommunity2015

4.6.2. cl.exe (C Compiler)

The following table gives an overview of the possible Microsoft toolchain variants and their specific C compiler versions ordered by release date.

Compiler Package

cl.exe

_MSC_VER

CRT DLL

Visual Studio 2015

14.0

1900

msvcr140.dll

After correct installation of the toolchain, typing at the Visual Studio Command line prompt (cmd.exe):

> cl

should result in something like:

Microsoft (R) C/{cpp} Optimizing Compiler Version 18.00.31101 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

usage: cl [ option... ] filename... [ /link linkoption...

However, the version string may vary.

Documentation on the compiler can be found at Microsoft Docs

4.6.3. link.exe (Linker)

After correct installation, typing at the Visual Studio Command line prompt (cmd.exe):

> link

should result in something like:

Microsoft (R) Incremental Linker Version 12.00.31101.0
Copyright (C) Microsoft Corporation.  All rights reserved.

 usage: LINK [options] [files] [@commandfile]
 ...

However, the version string may vary.

Documentation on the linker can be found at Microsoft Docs

4.6.4. C-Runtime "Redistributable" Files

Please note: The following is not legal advice - ask your preferred lawyer instead. It’s the authors view and this view might be wrong.

Depending on the Microsoft compiler version you use, some binary files coming from Microsoft might be required to be installed on Windows machine to run Wireshark. On a developer machine, the compiler setup installs these files so they are available - but they might not be available on a user machine!

This is especially true for the C runtime DLL (msvcr*.dll), which contains the implementation of ANSI and alike functions, e.g.: fopen(), malloc(). The DLL is named like: msvcrversion.dll, an abbreviation for "Microsoft Visual C Runtime". For Wireshark to work, this DLL must be available on the users machine.

Starting with MSVC7, it is necessary to ship the C runtime DLL (msvcrversion.dll) together with the application installer somehow, as that DLL is possibly not available on the target system.

[Note]Make sure you’re allowed to distribute this file

The files to redistribute must be mentioned in the redist.txt file of the compiler package. Otherwise it can’t be legally redistributed by third parties like us.

The following Microsoft Docs link is recommended for the interested reader:

In all cases where vcredist_x86.exe or vcredist_x64.exe is downloaded it should be downloaded to the directory into which the support libraries for Wireshark have been downloaded and installed. This directory is specified by the WIRESHARK_BASE_DIR or WIRESHARK_LIB_DIR environment variables. It need not, and should not, be run after being downloaded.

4.6.5. Windows (Platform) SDK

The Windows Platform SDK (PSDK) or Windows SDK is a free (as in beer) download and contains platform specific headers and libraries (e.g. windows.h, WSock32.lib, etc.). As new Windows features evolve in time, updated SDK’s become available that include new and updated APIs.

When you purchase a commercial Visual Studio or use the Community Edition, it will include an SDK.