Re: [gtkmm] Win32 and (maybe) Visual Studio



Hello All,

Here's my first stab at adding (Win32) Windows Installation documentation to 
the guide.  Wanted to get some suggestions and feedback from all of you before 
I submitted a patch.  What more needs to be added? I am assuming most people 
will be using Gtkmm with the Dev-Cpp IDE.  Seems to be the logical way to go.


-------------------- begin documentation ------------------------

<sect1>
<title>Windows Specific Instructions</title>
<para>
One of the major benefits of Gtkmm 2 is it's crossplatform nature.  Gtkmm 2 
programs written on other platforms such as GNU/Linux can generally be 
transferred to Windows (and vice versa) with few or no modifications to the 
source.
</para>

<sect2>
<title>Pre-Installation Issues</title>
<para>
Gtkmm 2 currently only works with the <ulink 
url="http://mingw.org/";>MingW/GCC3.2 compiler</ulink> on the windows platform.  
This is unlikely to change in the near future, unless Microsoft upgrades its 
compilers in Visual Studio to fully support the C++ standard.
</para>
<para>
Installation of MingW is beyond the scope of this document; however, a good 
GPL'd C++ IDE for windows called <ulink url="http://www.bloodshed.net/";>Dev-
Cpp</ulink> does have a convienent Windows installer that installs both the IDE 
and the MingW/GCC3.2 compiler.  The recommended IDE for Gtkmm development in 
Windows is Dev-Cpp.  The rest of this document assumes you are using Dev-Cpp as 
your development environment, and that you have installed it prior to 
installing Gtkmm 2.
</para>
<para>
It is strongly recommended that Dev-Cpp is installed and tested PRIOR to 
installing any of the Gtk+ or Gtkmm libraries, as we will be installing all the 
libraries into the Dev-Cpp directory.  Make sure you are able to successfully 
compile and run a simple C++ program from Dev-Cpp before proceeding to the next 
step. (ie. Hello World).
</para>
<para>
Note: Currently (as of v4.9.7.0) Dev-Cpp does not like to be installed in 
directories with spaces in them. Installing Dev-Cpp to the "Program Files" 
directory may cause problems at a later stage when it looks for the include and 
lib directories. 
</para>
<para>
If you only want to run Gtkmm software, and do not plan on writing any software 
that relies upon Gtkmm, you can skip the entire "Pre-Installation Issues" 
section above.
</para>
</sect2>

<sect2>
<title>Dependencies</title>
<para>
The windows installer of Gtkmm 2 will require you to first install the 
following dependencies:
</para>
<listitem><para>GTK+ 2.x</para></listitem>
<para>
Before installing Gtkmm 2, you need to install Gtk+ 2.x.  You can grab the 
latest windows installer from <ulink 
url="http://www.dropline.net/gtk/";></ulink>. The windows installer will 
correctly install any dependencies that Gtk+ 2.x may have.
</para>
<para>
Start with the Runtime Gtk+ installer, and allow the installation to proceed to 
the default directory.  When the installation is complete, continue with the 
Development Gtk+ Installer.  When installing Development Gtk+, you will change 
the installation directory from the default (currently c:\dev-c++) to wherever 
you have your Dev-Cpp installation (ie. d:\dev-cpp).
</para>
<para>
If you intend only to run Gtkmm programs on the windows platform, the "Runtime" 
installer is sufficient; however, if you also plan on doing development work, 
you will need to get both the runtime and the development installers.
</para>
</sect2>

<sect2>
<title>Installation</title>
<para>
Now you are ready to install the Gtkmm 2 libraries.  The preferred method is to 
grab the Gtkmm 2 installer from <ulink 
url="http://www.pcpm.ucl.ac.be/~gustin/win32_ports/";></ulink>.  The Gtkmm 2 
windows installer includes both the development and the runtime files.  
</para>
<para>
Again, if you plan on doing Gtkmm 2 development work, make sure to install all 
the development files, otherwise, you will only need the runtime files to run 
Gtkmm 2 programs.  (Currently, the development files are installed by default).
</para>
<para>
Since we are going to be using Dev-Cpp as our IDE, it is strongly suggested 
that you install Gtkmm 2 into the base Dev-Cpp directory (ie. d:\dev-cpp).  
This will make things easier later on when setting up the include and lib 
directories in Dev-Cpp.
</para>
<para>
After the installation is complete, you should have a working Gtkmm 
installation.  The last issue is the PATH environment variable.  Windows needs 
to know where to find the Gtkmm libraries.  The most recent versions of the 
Windows installer gives you the option of automatically adding the correct path 
to the PATH environemnt variable.  If you choose not to have the installer 
perform this last step for you, you may have to manually edit your PATH.
</para>
<para>
You should now be ready to execute Win32 Gtkmm compiled binaries.  Note: Some 
versions of Windows may require a reboot before the PATH variable takes 
effect.  
</para>
</sect2>

<sect2>
<title>Compiling Gtkmm Apps with Dev-Cpp</title>
<para>
There are now some changes that you need to make to the Dev-Cpp application you 
previously installed.
</para>
<para>
First, we need to let Dev-Cpp know what files and libraries to include when it 
invokes MingW/GCC3.2. To find out what arguements need to be passed to GCC, we 
need to open a command prompt and type the following:
</para>
<para>
<programlisting>
pkg-config --libs --cflags gtkmm-2.0
</programlisting>
</para>
<para>
If the pkg-config command cannot be found, you can cd to the bin/ directory of 
where you installed Dev-Cpp and execute the above line from there.  Depending 
on where you installed Gtkmm, you will get output that looks similar to the 
following:
</para>
<para>
<programlisting>
-Id:/dev-cpp/include/gtkmm-2.0 -Id:/dev-cpp/lib/gtkmm-2.0/include -Id:/dev-
cpp/include/gtk-2.0 -Id:/dev-cpp/lib/sigc++-1.2/include -Id:/dev-
cpp/include/sigc++-1.2 -Id:/dev-cpp/include/glib-2.0 -Id:/dev-cpp/lib/glib-
2.0/include -Id:/dev-cpp/lib/gtk-2.0/include -Id:/dev-cpp/include/pango-1.0 -
Id:/dev-cpp/include/atk-1.0  -Ld:/dev-cpp/lib -lgtkmm-2.0 -lgdkmm-2.0 -latkmm-
1.0 -lgtk-win32-2.0 -lpangomm-1.0 -lglibmm-2.0 -lsigc-1.2 -lgdk-win32-2.0 -latk-
1.0 -lgdk_pixbuf-2.0 -lpangowin32-1.0 -lgdi32 -lpango-1.0 -lgobject-2.0 -
lgmodule-2.0 -lglib-2.0 -lintl -liconv
</programlisting>
</para>

<para>
<figure id="figure-compiler-options">
  <title>Dev-Cpp Compiler Options</title>
  <screenshot>
    <graphic format="PNG" fileref="&url_figures_base;devcpp_c_options1.png"/>
  </screenshot>
</figure>
</para>

<para>
Now from the Dev-Cpp tools menu, select "Compiler Options". A new settings 
window will appear. Check the option "Add the following commands when calling 
compiler:", and then copy and paste the above output into the space shown above.
</para>

<para>
Congratulations! You should now have Dev-Cpp setup to work with Gtkmm 2.  Try 
compiling some of the examples in this tutorial!
</para>
</sect2>
</sect1>


--------------------- end documentation -------------------------

-- 
Gene Ruebsamen
Downey Savings

-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]