headers and libraries from the X11R6 release and the Motif 2.0
release. Newer versions of these can also be used.
<p><h3> C++ Compiler
</h3>
<aname="2-2"></a><p> Since TQt is a C++ toolkit, all new code will be written in C++. In
order for existing code to coexist with new code, a C++ compiler must
be able to compile the existing code.
<p> It is possible to keep existing code and new code separate, and only
convert or rewrite existing code as needed. This is a normal part
of the migration process, and does not need to be done before the
migration process begins. This is the most common scenario, and we
will demonstrate it by migrating existing C code to C++ as needed in
this walkthrough.
<p><h3> Build and Install the TQt Motif Extension
</h3>
<aname="2-3"></a><p> The <em>TQt Motif Extension</em> is not built and installed along with the
TQt toolkit. The extension resides in the <tt>extensions/motif</tt>
subdirectory. Run <em>make</em> in this directory to build the extension
and the examples. Once the extension has been built, run <em>make install</em>.
<p><pre>
$ cd extensions/motif
$ make
$ make install
</pre>
<p> The <em>TQt Motif Extension</em> is now installed and ready to use.
<p><h3> Build and Link the Project with the TQt Toolkit and the TQt Motif Extension
</h3>
<aname="2-4"></a><p> For simplicity, we use <em>qmake</em> to create the <tt>Makefile</tt>. The <tt>-project</tt> option causes <em>qmake</em> to automatically generate a project
file. After <em>qmake -project</em> has generated our project file, we
run <em>qmake</em> again to generate a <tt>Makefile</tt>. Now, we can just run <em>make</em> to build our project.
<p><pre>
$ qmake -project
$ qmake
$ make
</pre>
<p> Everything builds correctly, but fails to link because we don't link
with the Motif library. We tell <em>qmake</em> to do this by adding the <tt>-lXm</tt> to the <tt>LIBS</tt> variable in our project file. Since we are
planning to use the <em>TQt Motif Extension</em> in this project as well,
we should also add <tt>-lqmotif</tt> to the list of libraries.
<p><pre>
LIBS += -lXm -lqmotif
</pre>
<p> Now we regenerate our <tt>Makefile</tt> by running <tt>qmake</tt> again, and
rebuild using <tt>make</tt>. This time, our project successfully links, and
the application runs as expected.
<p> We are now ready to start using the <em>TQt Motif Extension</em>.