How to compile smplayer on Windows

Forum to talk about the development of SMPlayer (code, patches...).

How to compile smplayer on Windows

Postby rvm » Thu Dec 24, 2009 1:01 am

This is an updated document explaining how to compile smplayer under Windows.

It's not unusual that Linux users had to compile a program by themselves sometimes, but that's uncommon for Windows users.

Why compiling it?

There are several reasons:
  • be able to use the latest version without having to wait for the binary update.
  • modify the source code. You might need to make some small modification in the application.
  • get a statically linked binary, without dependencies on the Qt dlls

Compiling a program on Windows originally created under Linux can be difficult. For example, compiling mplayer is a hard task, a lot of packages have to be installed and compiled.

Fortunately compiling a Qt program is quite easy.

First you need to download and install Qt (OpenSource edition) in your computer. You can get a package with installer from
During the installation it will ask you for a compiler. Simply let the Qt installer to download and install MinGW.

Once the installation has finished it will probably will show you some Qt examples, so you can see how cute they are ;)

Now we're ready to compile smplayer (or any other Qt application). Download the sources (either the *.tar.gz or from the svn) and uncompress them for example in C:\smplayer.

The next step is to open the Qt console: select the option "Qt 4.2.3 Command Prompt" that you'll find under the Qt menu.

That'll open a DOS-like window. Type the following commands:
Code: Select all
cd c:\smplayer

Compiling will start. That'll take a few minutes (in my computer less than 2 minutes).

After that you'll get the new compiled smplayer.exe under c:\smplayer\src\release subdirectory.

You'll see that if you try to open it by double clicking on it, it won't work because it can find the Qt dlls. I assume you already have smplayer properly installed in some place, just copy the new smplayer.exe to that directory, replacing the old one. Now it will work :)

You may also need to copy the updated translation files (*.qm) from the translations subdirectory.

In a second part of this document I'll explain how to get a statically linked binary.
Site Admin
Posts: 2837
Joined: Wed Dec 23, 2009 1:25 am
Location: España

Re: How to compile smplayer on Windows

Postby rvm » Thu Dec 24, 2009 1:03 am

How to compile smplayer statically

A static build will not depend on the Qt dlls (QtCore4.dll, QtGui4.dll, QtNetwork4.dll and mingw10.dll). Also the application can startup faster.

The following steps I'm telling from memory, so I'm not sure if they are 100% accurate. If someone tries, please tell if it works.

Actually compiling smplayer is the same, nothing changes. But Qt itself has to be statically compiled.

Assuming you have Qt installed in C:\Qt\4.3.2:

  • open the "Qt 4.2.3 Command Prompt" in the Windows menu. The current directory should be already C:\Qt\4.3.2, if not, change to it:
    Code: Select all
    cd C:\Qt\4.3.2

  • now type:
    Code: Select all
    configure -static -release -no-exceptions

    That will take some minutes.
  • and finally we compile Qt:
    Code: Select all
    make sub-src

    That will take about 15-20 minutes to complete.

If everything is ok you'll have Qt compiled statically.

This process has to be done only once!

Now, when you compile smplayer (or any other Qt application) it will create a static binary.

If you have compiled smplayer before, it's recommended to clean the directory tree before recompiling:
(assuming you've got the sources in c:\smplayer)
Code: Select all
cd c:\smplayer

Now you can compile smplayer as usual:
Code: Select all

Now the binary should be bigger, about 7 or 8 MB size, but it should run without the dlls.
Site Admin
Posts: 2837
Joined: Wed Dec 23, 2009 1:25 am
Location: España

Re: How to compile smplayer on Windows

Postby rvm » Thu Dec 24, 2009 1:04 am

As of version 0.7.0, smplayer doesn't use Qxt, so skip this post

How to compile smplayer with Qxt support

From version r1176 is possible to compile SMPlayer with Qxt support. Qxt is a library which provides several new classes. SMPlayer will use QxtFileLock for a lock file in main.cpp. That should help to prevent that several instances of SMPlayer would run if lauched at almost the same time (which is done in Windows when selecting the "Enqueue in SMPlayer").

Using Qxt is optional. Without it SMPlayer will just use the old code for the lock file (which may fail sometimes).

First the instructions for Windows (it's easier):

(I assume you already have everything setup to compile smplayer)

Download libqxt-0.3.tar.gz and uncompress libqxt-0.3 in a folder without spaces in its name (otherwise installing will fail!), for instance in C:\Temp\libqxt-0.3

Open the Qt console and type:
Code: Select all
cd C:\Temp\libqxt-0.3
make install

By default Qxt will be installed in C:\libqxt

Now you can remove the folder C:\Temp\libqxt-0.3 if you want.

In the Qt console, go to the folder where you have the smplayer sources:
Code: Select all

That's it.

Don't forget to copy QxtCore.dll (from C:\libqxt\lib) to the smplayer.exe folder.
Last edited by rvm on Wed Feb 08, 2012 4:59 pm, edited 1 time in total.
Reason: Update
Site Admin
Posts: 2837
Joined: Wed Dec 23, 2009 1:25 am
Location: España

Re: How to compile smplayer on Windows

Postby rvm » Thu Dec 24, 2009 1:05 am

The possibility to download subtitles in zip format and uncompress them (added in r1989), makes a little bit more complicated to build smplayer on Windows.

Now it's necessary to compile zlib first. This is how:

* Download the source code:

* Uncompress it (for example in c:\development\zlib-1.2.6).

* Open the "Qt Command Prompt" and cd to that directory.

* Compile it with
Code: Select all
mingw32-make -fwin32\makefile.gcc

Now you can compile smplayer as usual, but just one thing: by default it will look for zlib in c:\development\zlib-1.2.3, if you installed it in another folder you'll have to edit src/ and change the path.
Last edited by rvm on Wed Feb 08, 2012 4:58 pm, edited 1 time in total.
Reason: Update
Site Admin
Posts: 2837
Joined: Wed Dec 23, 2009 1:25 am
Location: España

Re: How to compile smplayer on Windows

Postby redxii » Fri Dec 25, 2009 1:14 am


There are some slight differences in Qt 4.6.0. Not that SMPlayer ran at all when compiled with 4.6.0 (some error with QtCore4):
- The Qt 4.6.0 SDK includes MinGW. The libraries package no longer downloads MinGW so if you use that you must already have MinGW installed.
- The default install directory is different: e.g. C:\Qt\2009.05
- The 'make' command no longer works, it's 'mingw32-make' or 'mingw32-make install'

Changed locations:
- The Qt files are actually in C:\Qt\2009.05\qt and MinGW in C:\Qt\2009.05\mingw. So the install_smplayer script has to be adjusted.
User avatar
Posts: 503
Joined: Thu Dec 24, 2009 7:06 pm

Re: How to compile smplayer on Windows

Postby dpqmw80 » Tue Jun 28, 2011 4:07 am

I am still not able to run smplayer on Windows.It crashes
Posts: 1
Joined: Thu Jun 23, 2011 12:00 am
Location: Melbourne

Re: How to compile smplayer on Windows

Postby toponim » Mon May 21, 2012 4:04 pm

Hello everyone,

I have to use Smplayer a lot of time both on Linux and Windows platforms and want to say thanks for such good software.
Recently I decided to try and compile Smplayer with Windows's native toolchain (VS2008 Express edition in particularly). Here is my little experience and results of work:

Toolchain: VS2008 Express Edition;
Qt: 4.8.0 (compiled from scratch with mentioned toolchain)

First of all I have noticed issue with quazip sources. Issue specifically related to workaround which was introduced to deal with non-used function arguments warning. VS2008 cl doesn't allow to declare data after operations in C code so I add small workaround for this (you can find patch with my workaround in attach).
Second issue is addressed to Smplayer crash (probably same crash as reported by dpqmw80). After some debugging I have realized that reason of crash is using of wrong main.cpp file during compilation from command line. I don't have food explanation of this right now but it looks like nmake takes first main.cpp file from list. As a result I have Smplayer which include all needed source but main function taken from src\videopreview\main.cpp file. I shall admit that this issue doesn't occur when you use MSBuild instead of nmake (probably there is a issue in file and not in nmake itself).

So after all investigations I have written bat file with all instructions needed to compile Smplayer with VS2008 toolchain (please see in attach). Please note that file is not production ready and need to be run from "Visual Studio 2008 Command Prompt" (or you need to set all required environment variables by hand) and you shall have Qt framework under C:\Qt\4.8.0 path or set QT_DIR variable in bat file by hand.
I hope my experiment will be helpful. If using of Windows native toolchain will be considered possible I would be glad to help with this. Please feel free to contact me via email (toponim dog gmail dot com).
Set of commands which can be used to compile Smplayer with VS2008 toolchain
(472 Bytes) Downloaded 231 times
Set of patches for quazip
(822 Bytes) Downloaded 275 times
Posts: 1
Joined: Mon May 21, 2012 7:25 am

Re: How to compile smplayer on Windows

Postby ijammer » Mon Apr 01, 2013 4:53 am

Hi there, recently i tries to compile smplayer using Qt 4.8.0 + Visual Studio 2010
everything went well except for ioapi.c

it says this..

findsubtitles\quazip\ioapi.c(72): error C2275: 'FILE' : illegal use of this type as an expression

anybody know how to fix this issue...
Posts: 1
Joined: Mon Apr 01, 2013 4:49 am

Re: How to compile smplayer on Windows

Postby cyran0 » Fri Jun 13, 2014 10:08 pm

Hi, here is what I installed:

    mingw-get-setup.exe (selected mingw32-base & mingw32-gcc-g++) domain in OP been replaced since a while I think (Nokia takeover). I fund QT binaries at

Out of the box, compilation failed with
Code: Select all
release/moc_basegui.cpp:316:41: error: 'showVideoPreviewDialog' was not declared in this scope
    case 36: showVideoPreviewDialog(); break;
Makefile.Release:2019: recipe for target 'release/basegui.o' failed

Not defining VIDEOPREVIEW could let me move on.

I had now the executable file which a dropped in my SMPlayer installation dir but then I got
Code: Select all
Program received signal SIGSEGV, Segmentation fault.
0x6a21178b in QObject::QObject (this=0x4ff71e <__tcf_0()>, dd=..., parent=0x0)
    at kernel\qobject.cpp:769
769     kernel\qobject.cpp: No such file or directory.

At first I had DLL missing so I started the executable in a console with PATH=%PATH%;K:\MinGW\bin;K:\Qt\4.7.4\bin. Windows error box gave me:
Code: Select all
Problem signature:
  Problem Event Name:   APPCRASH
  Application Name:   smplayer_dev.exe
  Application Version:
  Application Timestamp:   539b13b3
  Fault Module Name:   QtCore4.dll
  Fault Module Version:
  Fault Module Timestamp:   4e5f8d4e
  Exception Code:   c0000005
  Exception Offset:   001037da
  OS Version:   6.3.9600.
  Locale ID:   4105
  Additional Information 1:   5861
  Additional Information 2:   5861822e1919d7c014bbb064c64908b2
  Additional Information 3:   d1d9
  Additional Information 4:   d1d94a13d3609d6b740644c12508f581

I tried masking some features but still no luck. From what I could see, looks like the crash occurs while loading the executable. I'm attaching some files that could help find the problem.

My system is a Intel i5 with Windows 8.1 Home.

Suggestions ?

For debugging, plain gdb is a bit awkward. What do you guys use ?
(3.14 KiB) Downloaded 131 times
(793 Bytes) Downloaded 113 times
(4.84 KiB) Downloaded 127 times
Posts: 2
Joined: Sun Mar 07, 2010 2:58 am

Re: How to compile smplayer on Windows

Postby rvm » Sat Jun 14, 2014 9:21 pm

I use Qt 4.8 and it compiles and runs ok.
Site Admin
Posts: 2837
Joined: Wed Dec 23, 2009 1:25 am
Location: España


Return to Development

Who is online

Users browsing this forum: No registered users and 1 guest