Sophie

Sophie

distrib > Mandriva > 10.0 > i586 > media > contrib > by-pkgid > af7a4b7f1ee5a4a084c41b9005da5527 > files > 2430

libfox1.1_46-devel-1.1.46-1mdk.i586.rpm

<html>
<head>
<link rel="stylesheet" href="page.css" type="text/css">
<title>Documentation:  Developing Win32 GUI Applications Using FOX</title>
</head>
<body bgcolor=#ffffff link=#990033 vlink=#990033 alink=#990033 text=#000000>

<!---- TOPIC TITLE WITH LOGO--->
<table border=0 cellpadding= cellspacing=2 width=100% ><tr><td><a href='http://www.fox-toolkit.org' target=_top><img src='art/foxlogo_small.jpg' border=0></a></td><td width=100% valign=bottom id="HEADLINE"><b>
Documentation:  Developing Win32 GUI Applications Using FOX <A href='win32.html' target="_top" align=left><font  size=-2>[Remove Frame]</font></a>
<br><img src='art/line.gif' width=100% height=1></b></td></tr></table>
</p>
<!--- TOPIC TITLE WITH LOGO --->
<ul>
  <p>FOX provides a nice platform-independent alternative to the traditional
  GUI frameworks for Win32 (namely MFC). While most of the other FOX documentation
  applies to FOX programming in general, this document deals specifically with
  some of the logistical details of creating a FOX-based application for Windows.
  Many thanks to <a href="mailto:gehriger@epfl.ch">Daniel Gehriger</a>, who
  provided a lot of the information you see here!</p>
</ul>


<!--- TOPIC TITLE -->
<p>
<table width=100% cellpadding=0 cellspacing=2><tr><td width=100% valign=bottom id=HEADLINE><b>
Compilers and Development Tools
<br><img src='art/line.gif' width=100% height=1></b></td></tr></table>
</p>
<!--- TOPIC TITLE -->
<ul>
  <p>One goal is for FOX to work with as many different compilers and
  development environments as possible. We have used Microsoft Visual C++ versions
  5.0 and 6.0, Borland C++ Builder 3.0 and gcc (or egcs) to build FOX applications
  for Windows. The standard FOX source code distribution includes project workspace
  files for Microsoft Visual C++ 6.0 as well as make files for Borland C++.
  You may also be able to use the Visual C++ project files with Visual C++
  5.0, but this is unconfirmed at present. For detailed information about how
  to build the library itself, please refer to the <tt>INSTALL</tt>file which
  is found in the top-level directory of the standard FOX distribution.</p>
</ul>

<!--- TOPIC TITLE -->
<p>
<table width=100% cellpadding=0 cellspacing=2><tr><td width=100% valign=bottom id=HEADLINE><b>
Using Microsoft Visual C++ 6.0
<br><img src='art/line.gif' width=100% height=1></b></td></tr></table>
</p>
<!--- TOPIC TITLE -->
<ul>
  <p>This section, and the following two sections, deal specifically
  with FOX development under Microsoft Visual C++ 6.0. This discussion assumes
  that you are at least <i>minimally</i> familiar with how to use Visual C++
  6.0. In particular, you should know how to create a new project workspace,
  and then add new project(s) to that workspace. Most of this information should
  be useful for Visual C++ 5.0 as well, although some settings may appear in
  different places.</p>
  <ol>
    <li><b>Create the project.</b> All FOX applications are just standard Win32
           applications, so when you create a new project select that option:</li>

    <p><center><img src="art/win32-project.png" height="400" width="561"></center></p>

    <li><b>Open the Project Settings dialog for this project.</b> You will want
        to make changes for both the compile-time options and link-time options
        of this project. Choose the <i>Settings...</i> option from the <i>Project</i>
      pulldown menu. Change to the "C/C++" tab and then select "Preprocessor" from
      the "Category" drop-down list:</li>

     <p><center><img src="art/win32-preprocessor.png" height="372" width="577"></center></p>

     <li><b>Modify preprocessor definitions for linking against the FOX
            DLL.</b>The FOX library can be built as either a static library or a dynamic
            link library (DLL). If you prefer to link your application against the DLL
            version of the library, you will need to add FOXDLL to the preprocessor definitions
            (not shown above).</li>
     <li><b>Modify preprocessor definitions for OpenGL.</b> If you plan
            to use FOX's OpenGL-related features you should also add HAVE_OPENGL to the preprocessor<br>
            definitions (as shown).</li>
     <li><b>Add FOX's include directory to the list of "Additional include
           directories".</b>This setting is on the "Preprocessor" page too!</li>

     <li><b>Add the FOX library to the list of input libraries for this
            application.</b>Now change to the "Link" tab of the Project Settings dialog
          box, and select "Input" from the "Category" drop-down list (see below). Add
          the appropriate library name (<tt>foxd.lib</tt> or <tt>foxdlld.lib</tt> for
          Debug builds;
          or <tt>fox.lib</tt> or <tt>foxdll.lib</tt> for Release builds) to the list
          of libraries under "Object/library modules".</li>

     <p><center><img src="art/win32-libraries.png" height="372" width="577"></center></p>
     <li><b>Add FOX's lib directory to the "Additional library path".</b> This setting
            is also on the "Input" page.</li>
     <li><a name="mainCRTStartup"></a><b>Change the entry-point symbol.</b>
                                         Now select "Output" from the drop-down list on the "Link" tab and type <b>mainCRTStartup</b>
            in the "Entry-point symbol" type-in field (see below). Note that this field
            is empty by default. This setting tells the linker to use your application's
          <tt>main()</tt>function as the entry point instead of the standard
          <tt>WinMain()</tt>function.</li>

     <center><img src="art/win32-linkoutput.png" height="372" width="577"></center>
  </ol>
</ul>


<!--- TOPIC TITLE -->
<p>
<table width=100% cellpadding=0 cellspacing=2><tr><td width=100% valign=bottom id=HEADLINE><b>
Common Problems
<br><img src='art/line.gif' width=100% height=1></b></td></tr></table>
</p>
<!--- TOPIC TITLE -->
<ul>
  <p>This section lists some commonly encountered problems for building Win32 applications with FOX.

  <p><b>Unresolved symbols at link time.</b> If you get one or more "error
  LNK2001" messages at link time, this usually means you've omitted required
  libraries from the list. Open the Project Settings dialog and change to the
  "Link" tab. On this tab, choose "Input" from the "Category" drop-down list.
  Finally, add the missing libraries to the list under "Object/library modules".
  Here is a list of commonly forgotten libraries:</p>

      <center>
      <table border="1" cellpadding="5" width="77%">
        <tbody>
          <tr>
            <td valign="top">
            <center><b>If the error message is...</b></center>
            </td>
            <td>
            <center><b>You need</b><br>
            <b>this library</b></center>
            </td>
          </tr>
          <tr>
            <td><tt>foxd.lib(FXPrintDialog.obj) : error LNK2001: unresolved
external symbol _EnumPrintersA@28</tt></td>
            <td><tt>winspool.lib</tt></td>
          </tr>
          <tr valign="top">
            <td><tt>foxd.lib(FXRegistry.obj) : error LNK2001: unresolved
external symbol __imp__RegCloseKey@4</tt><br>
            <tt>foxd.lib(FXRegistry.obj) : error LNK2001: unresolved external
symbol __imp__RegEnumKeyExA@32</tt><br>
            <tt>foxd.lib(FXRegistry.obj) : error LNK2001: unresolved external
symbol __imp__RegCreateKeyExA@36</tt><br>
            <tt>foxd.lib(FXRegistry.obj) : error LNK2001: unresolved external
symbol __imp__RegOpenKeyExA@20</tt><br>
            <tt>foxd.lib(FXRegistry.obj) : error LNK2001: unresolved external
symbol __imp__RegEnumValueA@32</tt><br>
            <tt>foxd.lib(FXRegistry.obj) : error LNK2001: unresolved external
symbol __imp__RegSetValueExA@24</tt><br>
            <tt>foxd.lib(FXRegistry.obj) : error LNK2001: unresolved external
symbol __imp__RegDeleteKeyA@8</tt></td>
            <td><tt>advapi32.lib</tt></td>
          </tr>
          <tr>
            <td><tt>foxd.lib(FXApp.obj) : error LNK2001: unresolved external
symbol __imp___TrackMouseEvent@4</tt></td>
            <td><tt>comctl32.lib</tt></td>
          </tr>
        </tbody>
      </table>
      </center>
  <p>On the other hand, if you get this error message:</p>
<pre>
MSVCRTD.lib(crtexew.obj) : error LNK2001: unresolved external symbol _WinMain@16
</pre>

  <p>this indicates that you forgot to change the application's entry-point symbol
  to <b>mainCRTStartup</b>. See <a href="#mainCRTStartup">this section</a>for
  the details.</p>

  <p><b>Missing support for JPEG or PNG images.</b> If you're trying
  to use the FXJPEGIcon, FXJPEGImage, FXPNGIcon or FXPNGImage classes and it
  doesn't seem to be working, it's possible that the FOX library was not compiled
  correctly to include support for these image formats. Load the FOX library
  project into Developer Studio and then launch the <i>Project Settings</i>
  dialog box. On the C/C++ tab of this dialog box, look at the list of preprocessor
  definitions and confirm that HAVE_JPEGLIB_H (for JPEG support) and/or HAVE_PNG_H
  (for PNG support) are defined. You will also want to be sure that the compiler
  can find its way to the JPEG and PNG header files, so make sure the include
  paths are correct as well. Note that these settings are only relevant for
  building the FOX library itself; you don't need to have HAVE_JPEGLIB_H or
  HAVE_PNG_H defined when compiling your FOX-based application code, nor do
  you need access to the JPEG or PNG header files. You <b>will</b> need to
  link your applications to the JPEG or PNG libraries, however.</p>
</ul>

<!--- TOPIC TITLE -->
<p>
<table width=100% cellpadding=0 cellspacing=2><tr><td width=100% valign=bottom id=HEADLINE><b>
Other Tips...
<br><img src='art/line.gif' width=100% height=1></b></td></tr></table>
</p>
<!--- TOPIC TITLE -->
<ul>
   <ol>
   <li>If you find yourself using FOX on a regular basis (as we hope)
  you might want to add its installation directory to the lists of standard
  directories searched by Visual C++ for include files and libraries. To do
  this, open the Options dialog by selecting the <i>Options...</i> command
  from the <i>Tools</i>pulldown menu, and switch to the "Directories" tab:</li>


  <P><center><img src="art/win32-tooloptions.png" height="319" width="417"></center></p>

  <ul>
  <p>Select "Include files" from the "Show directories for:"
  drop-down list and the list of directories should show the default include
  path (in order). Add your FOX installation's <b>include</b> directory to
  the end of the list. Then select "Library files" from the drop-down list
  and add your FOX installation's <b>lib</b> directory that list.</p></ul>

  <li>If you do link your executables against the FOX DLL, the executable
  needs to find it in the path when it runs. You can copy this DLL by hand
  to some directory in the path, but you may want to instead make the following
  modifications to automatically copy the DLL into your application's build
  directory (requires Windows NT). Start by opening the Project Settings dialog
  box and change to the "Post-Build Step" tab (it's on the far right, you'll
  need to scroll over to see it!)</li>

  <p><center><img src="art/win32-postbuild.png" height="372" width="577"></center></p>
  <ul><p>Add a description such as "Updating DLL..." to indicate
  what's going on; this message gets printed to the Build output window in
  Developer Studio when these commands are executed. Then, add the following
  two commands to the "Post-build command(s)" list:</p></ul>


        <blockquote><tt>REPLACE C:\src\fox\lib\foxdlld.dll /U Debug</tt><br>
          <tt>IF NOT EXIST Debug\foxdlld.dll COPY C:\src\fox\lib\foxdlld.dll
Debug</tt></blockquote>
You should, of course, use the correct path to the DLL for your FOX installation.
You should also be sure to copy the release build of the DLL (named <tt>foxdll.dll</tt>)
to your project's <tt>Release</tt> subdirectory, if that's the configuration
you're configuring.<br>
&nbsp;<li>You may want to add the <b>fox</b> or <b>foxdll</b> project (<tt>fox.DSP</tt>
or <tt>foxdll.DSP</tt>) to your own workspace, and configure a dependency<br>
from your application's project to the appropriate library's project. You<br>
can do this by selecting the <i>Dependencies...</i> option from the <i>Project</i>
pulldown menu, to open the Project Dependencies dialog box. That way you can
simply unpack a new FOX drop over the existing tree and your project will
first re-compile the new files before compiling your project.</li>
      </ol>
</ul>

<!--- TOPIC TITLE -->
<p>
<table width=100% cellpadding=0 cellspacing=2><tr><td width=100% valign=bottom id=HEADLINE><b>
Using the MinGW Compilers
<br><img src='art/line.gif' width=100% height=1></b></td></tr></table>
</p>
<!--- TOPIC TITLE -->
<ul>
      <p>The FOX library, and FOX-based applications, can now be built using
      the MinGW compilers and related Unix-like tools. If you are not familiar with
      this development option, but would like to know more, I recommend starting
      with the <a href="http://www.mingw.org/mingwfaq.shtml">MinGW FAQ list</a>.</p>
      <p><b>Disclaimer.</b> The process described here has been tested using
      the most recent release of the Cygwin tools (i.e. the 1.1.x series) and the
      MinGW tools, under Windows 2000.</p>
      <p>To get started, you will need to download and install the following
      packages:</p>
      <ul>
        <li>The <a href="http://sources.redhat.com/cygwin">Cygwin</a> tools, or<br>
        some reasonable substitute. You will at least need a bash-compatible shell<br>
        and GNU make version 3.76.1 or earlier;<br>
        </li>
        <li>The latest <a href="http://www.mingw.org">MinGW</a> distribution; and,<br>
        </li>
        <li>The latest <a href="http://www.fox-toolkit.org/fox.html">FOX</a> distribution;<br>
        </li>
      </ul>

    <p>If you want to use OpenGL, you'll also need to download the OpenGL header
    files MinGW; they are not a standard part of the packages listed above. Check
    the <a href="http://www.mingw.org/mingwfaq.shtml">MinGW FAQ list</a>for more
    information about how to develop OpenGL applications using MinGW.</p>

    <p>Now, because of some problems with the version of make distributed
    with MinGW (currently, make-3.77) you'll need to use an earlier version of
    make, such as the one distributed with the Cygwin tools (make-3.76.1). Ensure
    that the correct version of make is picked up by either renaming or deleting
    the version of make distributed with MinGW.</p>
    <p>Next, unpack the FOX distribution somewhere by typing, e.g.,</p>
<pre>
  tar xzf fox-0.99.149.tar.gz
</pre>
    <p> and then go to the top-level directory of the FOX distribution and type:</p>
<pre>
  ./configure
</pre>

    <p> If <tt>configure</tt> stops rather quickly, right after it prints the message
    about "checking whether make sets ${MAKE}", it's picking up the wrong version
    of make (see the notes a few paragraphs earlier).</p>
    <p>Once <tt>configure</tt> is finished doing its thing, and assuming
      there were no errors, build the library and supporting executables by typing:</p>
<pre>
 make
</pre>

<p>and then sit back and wait ;)</p>

</ul>

<!--- COPYRIGHT -->
<p>
<table width=100% cellpadding=0 cellspacing=0><tr><td width=100% valign=top id=HEADLINE align=right>
<img src='art/line.gif' width=100% height=1>
<font size=-1>Copyright &copy; 1997-2004 Jeroen van der Zijp</font>
</td></tr></table>
</p>
<!--- COPYRIGHT -->


</body>
</html>