]> git.saurik.com Git - wxWidgets.git/blame - docs/html/faqmac.htm
wxXmlNode::GetAttribute's pointer argument must not be NULL, check for it
[wxWidgets.git] / docs / html / faqmac.htm
CommitLineData
4e4dc03d 1
ce3ed50d
JS
2<HTML>
3
4<HEAD>
57d9fc85 5<TITLE>wxWidgets for Mac FAQ</TITLE>
ce3ed50d
JS
6</HEAD>
7
4e4dc03d 8<BODY BGCOLOR=#FFFFFF TEXT=#000000 VLINK="#00376A" LINK="#00529C" ALINK="#313063">
ce3ed50d
JS
9
10<font face="Arial, Lucida Sans, Helvetica">
11
4e4dc03d 12<table width=100% border=0 cellpadding=3 cellspacing=0>
ce3ed50d 13<tr>
4e4dc03d
JS
14<td bgcolor="#004080" align=left height=24 background="images/bluetitlegradient.gif">
15<font size=+1 face="Arial, Lucida Sans, Helvetica" color="#FFFFFF">
57d9fc85 16<b>wxWidgets for Mac FAQ</b>
ce3ed50d
JS
17</font>
18</td>
19</tr>
20</table>
21
22<P>
23
24See also <a href="faq.htm">top-level FAQ page</a>.
25<hr>
31523f51
GD
26<h3>List of questions in this category</h3>
27<ul>
53e112a0 28<li><a href="#release">Where should I download wxMac from?</a></li>
31523f51 29<li><a href="#macplat">Which Mac platforms are supported?</a></li>
31523f51 30<li><a href="#compilers">What compilers are supported?</a></li>
57d9fc85 31<li><a href="#conflicts">What can I do if I get conflicts between different installed versions of wxWidgets?</a></li>
cd508246
JS
32<li><a href="#filetypes">How does CVS handle file types/creators under Mac OS 8.x /9.x?</a></li>
33<li><a href="#filetypesx">How does CVS handle file types/creators under Mac OS X? </a></li>
57d9fc85
JS
34<!--
35<li><a href="#cwpro53">What steps are required to build wxMac using CodeWarrior Pro 5.3?</a></li>
36-->
8b283bb8 37<li><a href="#buildx">What steps are required to build wxMac under Mac OS X?</a></li>
4f3b37fd 38<li><a href="#settings">What important settings are required in the CodeWarrior Project Preferences?</a></li>
31523f51 39<li><a href="#smarterrors">What are the smart preprocessing errors with the Apple Developer Tools?</a></li>
8b283bb8 40<li><a href="#aboutmenu">How does wxMac support the standard Apple About menu item and Help menu?</a></li>
c2d48b36 41<li><a href="#findericon">How do I add an icon to my application?</a></li>
c140b7e7 42<li><a href="#switching">How can I easily switch between different versions of wxWidgets in CodeWarrior?</a></li>
31523f51
GD
43</ul>
44<hr>
ce3ed50d 45
53e112a0 46<h3><a name="release">Where should I download wxMac from?</a></h3>
31523f51 47
53e112a0 48Please see the <a href="dl_mac2.htm">downloads page</a>.
53e112a0
JS
49<P>
50The author of this port is <a href="mailto:csomor@advancedconcepts.ch">Stefan Csomor</a>.
31523f51
GD
51<P>
52
53<h3><a name="macplat">Which Mac platforms are supported?</a></h3>
54
57d9fc85
JS
55wxWidgets can be used to develop and deliver applications on Mac OS X and Mac Classic (e.g. Mac OS 8.x/9.x) both as Carbon and non-Carbon applications.
56However the Mac OS X port is the most actively developed one, and Mac Classic will not be supported
57after 2.6. wxMac works best with Mac OS X 10.3 and above.
31523f51
GD
58<P>
59
57d9fc85 60<h3><a name="compilers">What compilers are supported?</a></h3>
31523f51 61
57d9fc85 62Under Classic Mac OS, MetroWerks CodeWarrior Pro 6 (or above) is required to build wxMac.
31523f51 63<P>
57d9fc85 64Under Mac OS X, the Developer Tools are sufficient to build wxMac. CodeWarrior Pro 6 can also be used to build the Carbon targets.
31523f51
GD
65<P>
66
57d9fc85 67<h3><a name="conflicts">What can I do if I get conflicts between different installed versions of wxWidgets?</a></h3>
31523f51 68
57d9fc85
JS
69Some versions of Mac OS X install an older version of wxMac than the one you may be using
70for development. This can cause conflicts, such as link errors when building your
71applications. A user reports:<p>
31523f51 72
57d9fc85
JS
73<blockquote>
74I got it to work. I removed the original wxMac build-release folder
75and recompiled wxMac following instructions in your book. I then ran
76"sudo make install" which I didn't do the first time. I figured I
77could now run wx-config --cxxflags from my home directory because
78/usr/local/bin/wx-config was in my $PATH. However, OSX 10.4 installed
79a version of wxWidgets. When I ran wx-config I was getting wx 2.5
80libs instead of the 2.6.1 libs I just compiled. When I ran
81"/usr/local/bin/wx-config --cxxflags" and "/usr/local/bin/wx-config --libs"
82and pasted that output into XCode preferences, everything worked fine.
83</blockquote>
84<p>
31523f51
GD
85
86<h3><a name="filetypes">How does CVS handle file types/creators under Mac OS 8.x/9.x?</a></h3>
87
c140b7e7 88Before checking out the wxWidgets code using a CVS client under Mac OS 8.x/9.x, be sure your computer is set up to treat <code>xpm</code> and <code>xbm</code> images correctly:
31523f51
GD
89<ul>
90<li>bring up the Internet control panel, select the <i>Advanced Options</i> tab, click on the <i>File Mapping</i> icon from the list at the left and see if there are is an entry for ".xpm" files and another for ".xbm".
91<li>if an entry exists, click <i>Change...</i> and make sure <i>File Type</i> is <code>TEXT</code> (just those four capital letters); correct it if necessary. If there is no entry, make one with type set to <code>TEXT</code> and creator set to anything you like; reasonable choices include <code>GKON</code> (Graphic Converter) or <code>CWIE</code> (CodeWarrior).
92<li>if you want to edit <code>xpm</code> or <code>xbm</code> files in CodeWarrior, set up a file mapping in the CodeWarrior project settings for analogous to ".h" files.
93</ul>
94<P>
95
96<h3><a name="filetypesx">How does CVS handle file types/creators under Mac OS X?</a></h3>
97
98The Mac OS X CVS client does not handle file types and creators at all (just like every Unix command line CVS client). This is an issue only when the checked out files will also be used under Mac OS 8.x/9.x.
99<P>
100All files checked out under Mac OS X will be untyped and CodeWarrior will not recognize them correctly. To correct this, use the autotyper provided in the CVS sources:
101<ul>
c140b7e7
JS
102<li>decode and decompress the file <code>wxWidgets/docs/mac/TypeAsMetrowerksText.sea.hqx</code>
103<li>drag the wxWidgets CVS sandbox directory onto the autotyper and most of the files will be typed according to the file extension
31523f51
GD
104</ul>
105<P>
106
57d9fc85 107<!--
31523f51
GD
108<h3><a name="cwpro53">What steps are required to build wxMac using CodeWarrior Pro 5.3?</a></h3>
109
110The latest build for Carbon support lead to a few changes that you will have to follow in order to successfully compile the code.
111This is also necessary even if you don&#39;want to build the Carbon targets.
112
113<ol>
114<li>you need CodeWarrior Pro 5.3, i.e. 5.0 with all the upgrades
115<li>you have to download the Universal Interfaces 3.3.2 or later from the Apple Developer web site, Universal Interfaces 3.4 is required for Carbon Printing support
116<li>put the Universal folder into the MacOS Support folder and replace older versions
117<li>remove from the MacOS Support folder the separate OpenTransport folder
118<li>open the file MacOS Support:MacHeaders:MacHeaders.c and add the line
119 <pre>#include &lt;ControlDefinitions.h&gt;</pre>
120 after the line
121 <pre>#include &lt;Controls.h&gt;</pre>
122<li>rebuild all MacHeaders from the MacHeaders.mcp project in the same folder
123</ol>
124<P>
125Build the projects (<code>makemac6.mcp</code> for CodeWarrior Pro 6; <code>makemac.mpc</code> for CodeWarrior Pro 5) in the following five directories:
126<ul>
c140b7e7
JS
127<li>wxWidgets:src:
128<li>wxWidgets:src:jpeg:
129<li>wxWidgets:src:png:
130<li>wxWidgets:src:tiff:
131<li>wxWidgets:src:zlib:
31523f51
GD
132</ul>
133<P>
57d9fc85 134-->
31523f51
GD
135
136<h3><a name="buildx">What steps are required to build wxMac under Mac OS X?</a></h3>
137
138You need to have the Apple Developer Tools installed. The Developer Tools CD is one of the 3 CDs that are delivered with Mac OS X but must be installed in addition to the default Mac OS X installation.
139<P>
140Building wxMac completely without configure is not supported.
141<P>
c140b7e7
JS
142Building wxWidgets directly in the CVS sandbox is not recommended. Instead, wxWidgets should be built in a directory configured relatively to the CVS sandbox.
143For instance, to build wxMac with configure, start in the base wxWidgets directory and type:
31523f51
GD
144<ul>
145<li><code>mkdir macbuild</code>
146<li><code>cd macbuild</code>
147<li><code>../configure</code> <b>or</b> <code>../configure --enable-debug</code>
148<li><code>make</code>
149</ul>
150<P>
151
152<h3><a name="settings">What important settings are required in the CodeWarrior Project Preferences?</a></h3>
153
154For some reasons the CodeWarrior project settings may get changed and this may lead to the inability to compile a certain target. In order to verify the settings click on the target tab, double click on the respective target and then select the following items on the tree-view on the left. Here are the important checks:
155
156<ol>
157
158<li>under <code>Target/Access Paths</code>, make sure the first user include does not have a folder icon for recursive search.
159
160<li> under <code>Language Settings/C/C++ Language</code>, make sure that the only checked items are:
161<ul>
162<li><code>Enable C++ Exceptions</code>
163<li><code>Enable RTTI</code>
164<li><code>Enable bool Support</code>
165<li><code>Enable wchar_t Support</code>
166<li><code>Relaxed Pointer Type Rules</code>
167<li><code>Use Unsigned Chars</code>
168</ul>
169
170<li>under <code>Language Settings/C/C++ Warnings</code>, make sure that the only checked items are:
171<ul>
172<li><code>Illegal Pragmas</code>
173<li><code>Extended Error Checking</code>
174<li><code>Inconsistent Use of 'class' and 'struct' Keywords</code>
175<li><code>Hidden Virtual Functions</code> but be aware that the framework itself has some of these beauty spots
176</ul>
177
178<li>under <code>Linker/PPC Linker</code>, make sure that the following items are checked:
179<ul>
180<li><code>Dead-strip Static Initialization Code</code> in order to avoid including libraries that are not needed, especially as things like <a href="http://developer.apple.com/opengl/index.html">OpenGL</a> get added to the projects and sources
181</ul>
182
183</ol>
184<P>
185
186<h3><a name="smarterrors">What are the smart preprocessing errors with the Apple Developer Tools?</a></h3>
187
188Smart preprocessing is activated with the <code>-cpp-precomp</code> option and allows much faster preprocessing of the source files by loading precompiled Carbon header files. This option speeds up the compilation of wxMac by a factor of 2 at least.
189When compiling wxMac using the Apple Developer Tools, the following error is displayed for certain files:
190<ul>
191<li><code>cpp-precomp: warning: errors during smart preprocessing, retrying in basic mode</code>
192</ul>
193
194This error is due to the smart precompiler which does not fully understand C++ syntax and reverts to basic preprocessing when a smart preprocessing error occurs.
195This error can sometimes be corrected or avoided by modifying the source code. However, leaving these errors is not a problem since the preprocessor automatically switches to basic preprocessing if necessary.
196<P>
197
198<h3><a name="aboutmenu">How does wxMac support the standard Apple About menu item and Help menu?</a></h3>
199
c140b7e7 200Because wxWidgets does not have a specific API for the <i>About</i> menu item or the <i>Help</i> menu, the Mac OS port uses some static variables to help the engine make the right decisions:
31523f51
GD
201<ul>
202<li>It assumes that the <i>About</i> menu item is part of a <i>Help</i> menu.
966a4a52 203<li>The title of the <i>Help</i> menu is stored in <code>wxApp::s_macHelpMenuTitleName</code>, it defaults to "&amp;Help", but you can change it in your constructor to your specific menu title.
31523f51 204<li>The item Id of the <i>About</i> menu is stored in <code>wxApp::s_macAboutMenuItemID</code>, it defaults to <code>wxID_ABOUT</code>, but can be changed as well to suit your needs.
c140b7e7 205<li>The other items of the wxWidgets help menu are appended to the Mac OS <i>Help</i> menu and the translation of Ids is handled transparently for your application.
31523f51 206</ul>
ce3ed50d
JS
207<P>
208
c2d48b36
JS
209<h3><a name="findericon">How do I add an icon to my application?</a></h3>
210
211If you have Mac OS X, you have the icns editor somewhere in the
212Utilities folder. Create an icon using this tool and DeRez it, so that you have a .r
213file with a 'icns' resource with id (-16455). Include this .r file in
214your project and in the CodeWarrior Settings add a check mark under Linker:Output
215Flags/Finder Flags/Has Custom Icon.
216<P>
217
c140b7e7 218<h3><a name="switching">How can I easily switch between different versions of wxWidgets in CodeWarrior?</a></h3>
c2d48b36
JS
219
220Sometimes you want to test your application against different versions
c140b7e7 221of wxWidgets, for example a stable version of wxWidgets versus a development version.
c2d48b36
JS
222The easiest way to do this is to create a symbolic path.<P>
223
224Under Edit-Preferences in General:Source Trees, type a name (for example WXWIN)
225and choose a path for it. Now reselect your include and lib paths for a last
226time, in the settings for each configuration, but make them relative to the symbolic name.
227<P>
228
229From now on you can just change the path associated with the symbolic name.
230
231<P>
232
233
ce3ed50d
JS
234</font>
235
236</BODY>
237
238</HTML>