Developers Manual > Cocos2d-x > How To > User Contributed Tutorials > User Tutorial-mingw32 and QtCreator on Windows

How to compile cocos2d-x using mingw32 and QtCreator on Windows

Contributed By: Meir Yanovich

Introduction

What does this tutorial solve?

  • As of today there is no support for true cross compiling. That is to say the option to compile in one IDE and one compiler across all operating systems. Developers love compilers and IDE's other than Visual Studio. Although Visual Studio is great IDE there are other compiler and IDE options available for free to less cost.
  • Aims to simplify the option to port the Framework ot other platforms.
  • compile external libraries dependencies for mingw32 on Windows.

Setting up the tools

Step 1

Download cocod2d-x for windows , extract it.

open cocos2d-x-3.1\external\ directory , now in some directory's there is a need to create new
directory for the new prebuild libraries called "mingw32"

the list of the places :

  • external/sqlite3/libraries/mingw32
  • external/jpeg/prebuilt/mingw32
  • external/tiff/prebuilt/mingw32
  • /external/png/prebuilt/mingw32
  • /external/freetype2/prebuilt/mingw32
  • /external/curl/prebuilt/mingw32
  • /external/websockets/prebuilt/mingw32
  • /external/webp/prebuilt/mingw32
  • /external/bzip2/prebuilt/mingw32
  • /external/win32-specific-specific/gles/prebuilt/mingw32
  • /external/glfw3/prebuilt/mingw32

Step 2

Extract the cocos2d-x_external_lib_src.zip from my github . and copy only the static libiraris
to the new created mingw32 directorys
so it will look like this :

  • ./bzip2/prebuilt/mingw32/libbz2.a
  • ./curl/prebuilt/mingw32/libcurl.a
  • ./freetype2/prebuilt/mingw32/libfreetype.a
  • ./glfw3/prebuilt/mingw32/libglfw3.a
  • ./jpeg/prebuilt/mingw32/libjpeg.a
  • ./png/prebuilt/mingw32/libpng.a
  • ./sqlite3/libraries/mingw32/libsqlite3.a
  • ./tiff/prebuilt/mingw32/libtiff.a
  • ./webp/prebuilt/mingw32/libwebp.a
  • ./websockets/prebuilt/mingw32/libwebsockets.a
  • ./win32-specific/gles/prebuilt/mingw32/libglew32.a
  • ./win32-specific/gles/prebuilt/mingw32/libglew32mx.a

Step 3

rename in cocos2d-x root folder the CMakeLists.txt to CMakeLists.txt.tmp

and copy the Experimental CMakeLists.txt from my github you download in step 1

Step 4

As instructed in this tutorial:

The difference is that now it compiled also in windows 7

Thank you for your time and happy development !

Sign up for our newsletter to keep up with the latest developments, releases and updates for Cocos2d-x.