{"id":3688,"date":"2021-12-06T05:58:03","date_gmt":"2021-12-06T05:58:03","guid":{"rendered":"http:\/\/truelogic.org\/wordpress\/?p=3688"},"modified":"2022-07-10T09:16:03","modified_gmt":"2022-07-10T09:16:03","slug":"setting-up-wxwidgets-environment-for-c-in-windows-10","status":"publish","type":"post","link":"https:\/\/truelogic.org\/wordpress\/2021\/12\/06\/setting-up-wxwidgets-environment-for-c-in-windows-10\/","title":{"rendered":"Setting up wxWidgets Environment for C++ in Windows 10"},"content":{"rendered":"\n<p><strong>OVERVIEW<\/strong><\/p>\n\n\n\n<p>wxWidgets is primarily something which is used under Linux and *nix platforms and is definitely not the first choice of a UI framework for C++ when it comes to Windows. Visual Studio offers several options in that department &#8211; WinForms, WPF, Silverlight, Razor, Blazor etc.. And with the advent of .NET Core , you can create cross-platform apps using native libraries. Anyway, wxWidgets can still be used on Windows and here we see how to set it up for use under Windows 10.<\/p>\n\n\n\n<p>I have avoided using any Microsoft tools and IDEs like Visual Studio or Visual Code. This is meant to be a bare bones environment which you can use from the command line.<\/p>\n\n\n\n<p><strong>SETUP MSYS2<\/strong><\/p>\n\n\n\n<p>The objective is to use Mingw64 as the C++ compiler to use for compiling wxWidgets itself and then building applications using wxWidgets. We can directly go to the MingW site and download the binaries and set them up, but it is quite error prone and can take a good amount of back and forth till you get it right. <\/p>\n\n\n\n<p>A far easier and better option is to use MSYS2 to setup the MingW compiler. It takes care of all the headaches for you and is a life-saver. MingW not only installs MingW but all other possible C++ compilers like CLang and CygWin.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Go to https:\/\/www.msys2.org\/ and download the installer exe file.<\/li><li>After downloading, run the installer.<\/li><li>Select the path where it should be installed: eg.<em>d:\\msys64<\/em> and click Next<\/li><li>Set a Start Menu shortcut name and click Next<\/li><li>The installation will start<\/li><li>Click Next and then click Finish<\/li><li>At this point , the command console of MSYS2 will open up<\/li><li>Update the package database by typing <em>pacman -Syu<\/em> and pressing Enter<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"823\" height=\"481\" src=\"https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2022\/07\/pacman.png\" alt=\"\" class=\"wp-image-4367\" srcset=\"https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2022\/07\/pacman.png 823w, https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2022\/07\/pacman-620x362.png 620w, https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2022\/07\/pacman-300x175.png 300w, https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2022\/07\/pacman-768x449.png 768w\" sizes=\"auto, (max-width: 823px) 100vw, 823px\" \/><\/figure>\n\n\n\n<p>The command window now closes. To complete the process, we need to run MSYS2 from the Start Menu<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Go to Start-&gt;MSYS2 MSYS<\/li><li>In the command window type <em>pacman -Su <\/em>and press Enter<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"702\" height=\"375\" src=\"https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2022\/07\/pacman2.png\" alt=\"\" class=\"wp-image-4369\" srcset=\"https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2022\/07\/pacman2.png 702w, https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2022\/07\/pacman2-620x331.png 620w, https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2022\/07\/pacman2-300x160.png 300w\" sizes=\"auto, (max-width: 702px) 100vw, 702px\" \/><\/figure>\n\n\n\n<p>The next step is to install MingW64 toolset, <\/p>\n\n\n\n<p><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li> Use the command <em>pacman -S &#8211;needed base-devel mingw-w64-x86_64-toolchain<\/em> and press Enter <\/li><li>For <em>Enter a Selection<\/em> choose <em>default=all<\/em> and press Enter<\/li><li>For the next option <em>Enter a Selection <\/em>choose <em>default=all<\/em> and press Enter<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"702\" height=\"375\" src=\"https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2022\/07\/pacman3.png\" alt=\"\" class=\"wp-image-4371\" srcset=\"https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2022\/07\/pacman3.png 702w, https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2022\/07\/pacman3-620x331.png 620w, https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2022\/07\/pacman3-300x160.png 300w\" sizes=\"auto, (max-width: 702px) 100vw, 702px\" \/><\/figure>\n\n\n\n<p>Press Enter to start the installation of the required files<\/p>\n\n\n\n<p>Once the process finishes, installation of MSYS2 is complete.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"776\" height=\"494\" src=\"https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2022\/07\/pacman4.png\" alt=\"\" class=\"wp-image-4373\" srcset=\"https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2022\/07\/pacman4.png 776w, https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2022\/07\/pacman4-620x395.png 620w, https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2022\/07\/pacman4-300x191.png 300w, https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2022\/07\/pacman4-768x489.png 768w\" sizes=\"auto, (max-width: 776px) 100vw, 776px\" \/><\/figure>\n\n\n\n<p><strong>SETTING UP WXWIDGETS<\/strong><\/p>\n\n\n\n<p>We will download and compile the wxWidgets library .<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Go to http:\/\/wxwidgets.org\/downloads\/ and click on the <em>Windows Zip <\/em>link under Source Code. This will download the windows source for wxWidgets<\/li><li>Create a folder where the file will be unzipped eg. <em>d:\\wxWidgets<\/em> and unzip the contents into that folder.<\/li><li>We will now use the MSYS2 console to build the library<\/li><li>Go to <em>Start-&gt;MSYS2 MinGW x64 <\/em><\/li><li>In the MSYS2 console go to the folder where the wxWidgets source has been unzipped. To change the drive use <em>cd \/&lt;drive&gt;\/<\/em> eg. <em>cd \/d\/<\/em><\/li><li>To see the current working directory use the <em>pwd <\/em>command. <\/li><li>Assuming the folder is d:\\wxWidgets, once we are in drive d. do<em> cd wxWidgets<\/em><\/li><li>Type <em>dir <\/em>to see the contents of the directory<\/li><li>To create the static (non-shared) debug version do the following commands<\/li><li><em>mkdir build-debug<\/em><\/li><li><em>cd build-debug<\/em><\/li><li><em>..\/configure &#8211;disable-shared &#8211;enable-debug<\/em><\/li><li>This will take some time to configure the files<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"940\" height=\"448\" src=\"https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2022\/07\/wx1-940x448.png\" alt=\"\" class=\"wp-image-4375\" srcset=\"https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2022\/07\/wx1-940x448.png 940w, https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2022\/07\/wx1-620x295.png 620w, https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2022\/07\/wx1-300x143.png 300w, https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2022\/07\/wx1-768x366.png 768w, https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2022\/07\/wx1.png 1010w\" sizes=\"auto, (max-width: 940px) 100vw, 940px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Once the configuration process is complete, we build the library by typing <em>make<\/em><\/li><\/ul>\n\n\n\n<p><strong>BUILDING A SAMPLE APPLICATION<\/strong><\/p>\n\n\n\n<p>We will now create a very basic C++ application using wxWidgets and then build  an executable. Create a folder where your source files will go eg. <em>d:\\projects\\wxWidgets<\/em>. Create the following file called <em>simplewindow.cpp<\/em> in a text editor:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\n\/\/ For compilers that support precompilation, includes &quot;wx\/wx.h&quot;.\n#include &quot;wx\/wxprec.h&quot;\n\/\/ for all others, include the necessary headers (this file is usually all you\n\/\/ need because it includes almost all &quot;standard&quot; wxWidgets headers)\n#ifndef WX_PRECOMP\n    #include &quot;wx\/wx.h&quot;\n#endif\nclass MyFrame : public wxFrame\n{\npublic:\n    MyFrame()\n        : wxFrame(NULL, wxID_ANY, _(&quot;Test&quot;))\n    {}\n};\nclass MyApp : public wxApp\n{\npublic:\n    virtual bool OnInit() override\n    {\n        myFrame.Show();\n        return true;\n    }\nprivate:\n    MyFrame myFrame;\n};\nIMPLEMENT_APP(MyApp)\n<\/pre><\/div>\n\n\n<p>What the above code does is show a simple resizable window and nothing else. We need to copy the generated files and folders from the <em>d:\\wxWidgets<\/em> folder first.<\/p>\n\n\n\n<p>From the <em>build-debug <\/em>folder copy the <em>lib<\/em> folder to the application folder<\/p>\n\n\n\n<p>Next copy the <em>includes <\/em>folder to the application folder.<\/p>\n\n\n\n<p>Now you should have two subfolders <em>include<\/em> and <em>lib<\/em> in your application folder.<\/p>\n\n\n\n<p>The makefile used to create the executable is given below. There are a lot of options present there. We have taken a makefile from one of the sample applications which are part of the wxWidgets package and changed it to suit our needs.  Make sure that the paths specified in the makefile are matching yours. The file name for makefile is <em>makefile<\/em><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nappname=simplewindow\nprefix = \/mingw64\nexec_prefix = ${prefix}\ndatarootdir = ${prefix}\/share\nINSTALL = \/usr\/bin\/install -c\nEXEEXT = .exe\nWINDRES = windres\nNM = nm\nBK_DEPS = \/d\/wxWidgets\/build-debug\/bk-deps\nsrcdir = .\ntop_srcdir = .\nLIBS = -lz -lrpcrt4 -loleaut32 -lole32 -luuid -llzma -luxtheme -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lcomdlg32 -ladvapi32 -lversion -lwsock32 -lgdi32 -loleacc -lwinhttp\nLDFLAGS_GUI = -mwindows\nCXX = g++\nCXXFLAGS = \nCPPFLAGS = \nLDFLAGS = \nUSE_DPI_AWARE_MANIFEST = 2\nWX_LIB_FLAVOUR = \nTOOLKIT = MSW\nTOOLKIT_LOWERCASE = msw\nTOOLKIT_VERSION = \nTOOLCHAIN_FULLNAME = msw-unicode-static-3.1\nEXTRALIBS =    -lz -lrpcrt4 -loleaut32 -lole32 -luuid -llzma -luxtheme -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lcomdlg32 -ladvapi32 -lversion -lwsock32 -lgdi32 -loleacc -lwinhttp \nEXTRALIBS_XML =  -lexpat\nEXTRALIBS_GUI = -llzma\nWX_CPPFLAGS = -I${wx_top_builddir}\/lib\/wx\/include\/msw-unicode-static-3.1 -I${top_srcdir}\/include -D_FILE_OFFSET_BITS=64 \nWX_CXXFLAGS = -Wall -Wundef -Wunused-parameter -Wno-ctor-dtor-privacy -Woverloaded-virtual -g -O0   \nWX_LDFLAGS =  \nHOST_SUFFIX = \nSAMPLES_RPATH_FLAG = \nSAMPLES_CXXFLAGS =  \nwx_top_builddir = D:\/wxWidgets\/build-debug\n### Variables: ###\nDESTDIR = \nWX_RELEASE = 3.1\nWX_VERSION = $(WX_RELEASE).5\nLIBDIRNAME = $(wx_top_builddir)\/lib\nMAINAPP_CXXFLAGS = $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \\\n\t$(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \\\n\t$(__THREAD_DEFINE_p) -I$(srcdir) $(__DLLFLAG_p) -I$(srcdir). \\\n\t$(WX_CXXFLAGS) $(SAMPLES_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS)\nMAINAPP_OBJECTS =  \\\n\t$(__MAINAPP___win32rc) \\\n\tMAINAPP_main.o\n### Conditionally set variables: ###\n#CXXC = $(CXX)\nCXXC = $(BK_DEPS) $(CXX)\n#PORTNAME = base\nPORTNAME = $(TOOLKIT_LOWERCASE)$(TOOLKIT_VERSION)\n#WXBASEPORT = _carbon\n#WXDEBUGFLAG = d\nWXUNICODEFLAG = u\n#WXUNIVNAME = univ\nEXTRALIBS_FOR_BASE = $(EXTRALIBS)\n#EXTRALIBS_FOR_BASE = $(EXTRALIBS) \\\n#\t$(EXTRALIBS_XML) $(EXTRALIBS_GUI)\nEXTRALIBS_FOR_GUI = $(EXTRALIBS_GUI)\n#EXTRALIBS_FOR_GUI = \n#__WXUNIV_DEFINE_p = -D__WXUNIVERSAL__\n#__WXUNIV_DEFINE_p_1 = --define __WXUNIVERSAL__\n#__DEBUG_DEFINE_p = -DwxDEBUG_LEVEL=0\n#__DEBUG_DEFINE_p_1 = --define wxDEBUG_LEVEL=0\n#__EXCEPTIONS_DEFINE_p = -DwxNO_EXCEPTIONS\n#__EXCEPTIONS_DEFINE_p_1 = --define wxNO_EXCEPTIONS\n#__RTTI_DEFINE_p = -DwxNO_RTTI\n#__RTTI_DEFINE_p_1 = --define wxNO_RTTI\n#__THREAD_DEFINE_p = -DwxNO_THREADS\n#__THREAD_DEFINE_p_1 = --define wxNO_THREADS\n#__DLLFLAG_p = -DWXUSINGDLL\n#__DLLFLAG_p_1 = --define WXUSINGDLL\n__WIN32_DPI_MANIFEST_p = \\\n\t--define \\\n\twxUSE_DPI_AWARE_MANIFEST=$(USE_DPI_AWARE_MANIFEST)\nCOND_PLATFORM_OS2_1___MAINAPP___os2_emxbindcmd = $(NM) $(appname)$(EXEEXT) \\\n\t| if grep -q pmwin.763 ; then emxbind -ep $(appname)$(EXEEXT) ; fi\n#__MAINAPP___os2_emxbindcmd = $(COND_PLATFORM_OS2_1___MAINAPP___os2_emxbindcmd)\n__RCDEFDIR_p = --include-dir \\\n\t$(LIBDIRNAME)\/wx\/include\/$(TOOLCHAIN_FULLNAME)\n#__MAINAPP___win32rc = MAINAPP_MAINAPP_rc.o\n#__MAINAPP_app_Contents_PkgInfo___depname \\\n#\t= simplewindow.app\/Contents\/PkgInfo\n#__MAINAPP_bundle___depname = MAINAPP_bundle\n#____MAINAPP_BUNDLE_TGT_REF_DEP = \\\n#\t$(__MAINAPP_app_Contents_PkgInfo___depname)\n#____MAINAPP_BUNDLE_TGT_REF_DEP \\\n#\t= $(__MAINAPP_app_Contents_PkgInfo___depname)\n#____MAINAPP_BUNDLE_TGT_REF_DEP \\\n#\t= $(__MAINAPP_app_Contents_PkgInfo___depname)\n#____MAINAPP_BUNDLE_TGT_REF_DEP \\\n#\t= $(__MAINAPP_app_Contents_PkgInfo___depname)\n#____MAINAPP_BUNDLE_TGT_REF_DEP = \\\n#\t$(__MAINAPP_app_Contents_PkgInfo___depname)\nCOND_MONOLITHIC_0___WXLIB_CORE_p = \\\n\t-lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core-$(WX_RELEASE)$(HOST_SUFFIX)\n__WXLIB_CORE_p = $(COND_MONOLITHIC_0___WXLIB_CORE_p)\nCOND_MONOLITHIC_0___WXLIB_BASE_p = \\\n\t-lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)\n__WXLIB_BASE_p = $(COND_MONOLITHIC_0___WXLIB_BASE_p)\nCOND_MONOLITHIC_1___WXLIB_MONO_p = \\\n\t-lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)\n#__WXLIB_MONO_p = $(COND_MONOLITHIC_1___WXLIB_MONO_p)\n#__LIB_SCINTILLA_IF_MONO_p \\\n#\t= \\\n#\t-lwxscintilla$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)\n__LIB_TIFF_p \\\n\t= \\\n\t-lwxtiff$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)\n__LIB_JPEG_p \\\n\t= \\\n\t-lwxjpeg$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)\n__LIB_PNG_p \\\n\t= \\\n\t-lwxpng$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)\n#__LIB_ZLIB_p = \\\n#\t-lwxzlib$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)\nCOND_wxUSE_REGEX_builtin___LIB_REGEX_p = \\\n\t-lwxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)\n__LIB_REGEX_p = $(COND_wxUSE_REGEX_builtin___LIB_REGEX_p)\n#__LIB_EXPAT_p = \\\n#\t-lwxexpat$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)\n### Targets: ###\nall: mainapp$(EXEEXT) $(__MAINAPP_bundle___depname)\ninstall: \nuninstall: \ninstall-strip: install\nclean: \n\trm -rf .\/.deps .\/.pch\n\trm -f .\/*.o\n\trm -f mainapp$(EXEEXT)\n\trm -rf mainapp.app\ndistclean: clean\n\trm -f config.cache config.log config.status bk-deps bk-make-pch shared-ld-sh Makefile\nmainapp$(EXEEXT): $(MAINAPP_OBJECTS) \n\t$(CXX) -o $@ $(MAINAPP_OBJECTS)    -L$(LIBDIRNAME)  $(LDFLAGS_GUI) $(LDFLAGS)  $(WX_LDFLAGS) $(__WXLIB_CORE_p)  $(__WXLIB_BASE_p)  $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p)  $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS)\n\t$(__MAINAPP___os2_emxbindcmd)\nMAINAPP_main.o: $(srcdir)\/$(appname).cpp \n\t$(CXXC) -c -o $@ $(MAINAPP_CXXFLAGS) $(srcdir)\/$(appname).cpp\n# Include dependency info, if present:\n-include .\/.deps\/*.d\n.PHONY: all install uninstall clean distclean MAINAPP_bundle\n\n<\/pre><\/div>\n\n\n<p>Please note that the version number of the wxWidgets library being used has to be correct. For eg. the above makefile assumes that you are using wxWidgets 3.1 . But if you use a later version, then 3.1 has to be changed to 3.2 otherwise the build will fail. The specific places where this change has to be done are shown below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>TOOLCHAIN_FULLNAME = msw-unicode-static-3.2\nWX_RELEASE = 3.2\nWX_CPPFLAGS = -I${wx_top_builddir}\/lib\/wx\/include\/msw-unicode-static-3.2 -I${top_srcdir}\/include -D_FILE_OFFSET_BITS=64 \n<\/code><\/pre>\n\n\n\n<p>At the MSYS2 command make sure you are in the application folder eg.<em>d:\\projects\\wxProjects <\/em> and then type <em>make<\/em><\/p>\n\n\n\n<p>You should get the following output signifying that the executable has been made.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"828\" height=\"375\" src=\"https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2022\/07\/exe1.png\" alt=\"\" class=\"wp-image-4380\" srcset=\"https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2022\/07\/exe1.png 828w, https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2022\/07\/exe1-620x281.png 620w, https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2022\/07\/exe1-300x136.png 300w, https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2022\/07\/exe1-768x348.png 768w\" sizes=\"auto, (max-width: 828px) 100vw, 828px\" \/><\/figure>\n\n\n\n<p>Run the executable with <em>.\/main<\/em>app. The app will run and show a simple window as shown below<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"387\" height=\"490\" src=\"https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2022\/07\/screenwindow.png\" alt=\"\" class=\"wp-image-4387\" srcset=\"https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2022\/07\/screenwindow.png 387w, https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2022\/07\/screenwindow-300x380.png 300w\" sizes=\"auto, (max-width: 387px) 100vw, 387px\" \/><\/figure>\n\n\n\n<p>What we have now is the debug version of wxWidgets for building wxWidgets applications. You can create a release version also by going to the wxWidgets folder eg. <em>d:\\wxWidgets<\/em> and then using the following commands as before:<\/p>\n\n\n\n<p><em>mkdir build-release<\/em><\/p>\n\n\n\n<p><em>cd build-<\/em>release<\/p>\n\n\n\n<p><em>..\/configure &#8211;disable-shared <\/em><\/p>\n\n\n\n<p>followed by a <em>make<\/em> command<\/p>\n\n\n\n<p>Coming back to the task of running the application, it runs fine as long as you are running it from within MSYS2 command prompt. But if you double click it from the Windows explorer then it starts giving missing runtime DLL errors. These DLLs are the runtime DLL files required for minGW and not wxWidgets. <\/p>\n\n\n\n<p>These DLLs will be found within the msys folder. Eg.if you installed MSYS2 in <em>D:\\msys64<\/em> then the required DLL files will be in <em>D:\\msys64\\mingw64\\bin<\/em><\/p>\n\n\n\n<p>You can either add this folder to the PATH environment variable or copy them to the same folder as your application. That will solve the problem of the runtime DLL not being found.<\/p>\n\n\n\n<p>Remember if you make changes to your source code, then run <em>make clean <\/em>first to clean the generated files before you run a <em>make <\/em>again to make a new executable.<\/p>\n\n\n\n<p><strong>CONCLUSION<\/strong><\/p>\n\n\n\n<p>This was a quick and practical way of setting up wxWidgets in Windows 10 to enable C++ development. The makefile will undergo more changes as you start building projects with multiple source and header files. If you come from a Visual Studio background then having to deal with makefiles is something new as VS takes care of all that automatically. But its good to understand the basic working of a makefile so you are not dependent on a particular IDE or tool to build your application. I will explore wxWidgets programming more in the coming days.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>OVERVIEW wxWidgets is primarily something which is used under Linux and *nix platforms and is definitely not the first choice of a UI framework for <a class=\"mh-excerpt-more\" href=\"https:\/\/truelogic.org\/wordpress\/2021\/12\/06\/setting-up-wxwidgets-environment-for-c-in-windows-10\/\" title=\"Setting up wxWidgets Environment for C++ in Windows 10\">[&#8230;]<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":3595,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[302,15,365],"tags":[],"class_list":["post-3688","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cc","category-windows","category-wxwidgets"],"_links":{"self":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts\/3688","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/comments?post=3688"}],"version-history":[{"count":45,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts\/3688\/revisions"}],"predecessor-version":[{"id":4388,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts\/3688\/revisions\/4388"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/media\/3595"}],"wp:attachment":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/media?parent=3688"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/categories?post=3688"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/tags?post=3688"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}