
wxMac FAQ
See also top-level FAQ page.
List of questions in this category
Where should I download wxMac from?
Please see the downloads page.
You can download and install wxAll or wxMac. wxMac is a subset of wxAll which
excludes the files that are not needed on Mac OS X.
Which Mac platforms are supported?
wxWidgets can be used to develop and deliver applications on Mac OS X and
Mac Classic (e.g. Mac OS 8.x/9.x) as Carbon or Cocoa applications.
However the Mac OS X port is the most actively developed one, and Mac Classic
will not be supported after 2.6. wxMac works best with Mac OS X 10.3 and
above.
What compilers are supported?
Under Mac OS X, the free Developer Tools from Apple are all you need to build wxMac. CodeWarrior Pro 6 can also be used to build the Carbon targets.
Under Classic Mac OS, MetroWerks CodeWarrior Pro 6 (or above) is required
to build wxMac.
What steps are required to build wxMac under Mac OS X?
First download and install the free Xcode IDE from Apple at http://developer.apple.com
Next download and unpack wxWidgets.
Then follow the instructions in docs/osx/install.txt for compiling the libraries from a Terminal window. (In wxWidgets 2.8.x, this file is called docs/mac/install.txt.)
Try some of the samples and demos to see how well wxWidgets works on your Mac.
Finally start your own Xcode project using the instructions in the wxWiki under Guides & Tutorials
What can I do if I get conflicts between different installed versions of wxWidgets?
For most development work, this is not an issue. You can have many versions of wxWidgets on your computer at the same time without conflict. You will only encounter this problem if you try to install wxWidgets into /usr/local/bin.
Some versions of Mac OS X install an older version of wxMac than the one
you may be using for development. This can cause conflicts, such as link
errors when building your applications. A user reports:
I got it to work. I removed the original wxMac build-release
folder and recompiled wxMac following instructions in your book. I then ran
"sudo make install" which I didn't do the first time. I figured I could now
run wx-config --cxxflags from my home directory because
/usr/local/bin/wx-config was in my $PATH. However, OSX 10.4 installed a
version of wxWidgets. When I ran wx-config I was getting wx 2.5 libs instead
of the 2.6.1 libs I just compiled. When I ran
"/usr/local/bin/wx-config --cxxflags" and "/usr/local/bin/wx-config --libs"
and pasted that output into XCode preferences, everything worked
fine.
How does CVS handle file types/creators under Mac OS 8.x/9.x?
Before 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 xpm and
xbm images correctly:
- Bring up the Internet control panel, select the Advanced Options
tab, click on the File Mapping icon from the list at the left and
see if there are is an entry for ".xpm" files and another for
".xbm".
- If an entry exists, click Change... and make sure File
Type is TEXT (just those four capital letters); correct it
if necessary. If there is no entry, make one with type set to
TEXT and creator set to anything you like; reasonable choices
include GKON (Graphic Converter) or CWIE
(CodeWarrior).
- If you want to edit xpm or xbm files in CodeWarrior,
set up a file mapping in the CodeWarrior project settings for analogous
to ".h" files.
How does CVS handle file types/creators under Mac OS X?
The 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.
All 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:
- Decode and decompress the file
wxWidgets/docs/mac/TypeAsMetrowerksText.sea.hqx
- Drag the wxWidgets CVS sandbox directory onto the autotyper and most of
the files will be typed according to the file extension.
What important settings are required in the CodeWarrior Project Preferences?
For 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:
- Under Target/Access Paths, make sure the first user include
does not have a folder icon for recursive search.
- Under Language Settings/C/C++ Language, make sure that the only
checked items are:
- Enable C++ Exceptions
- Enable RTTI
- Enable bool Support
- Enable wchar_t Support
- Relaxed Pointer Type Rules
- Use Unsigned Chars
- Under Language Settings/C/C++ Warnings, make sure that the only
checked items are:
- Illegal Pragmas
- Extended Error Checking
- Inconsistent Use of 'class' and 'struct' Keywords
- Hidden Virtual Functions --- but be aware that the framework itself
has some of these beauty spots.
- Under Linker/PPC Linker, make sure that the following items are
checked:
- Dead-strip Static Initialization Code --- in order to avoid
including libraries that are not needed, especially as things like
OpenGL
get added to the projects and sources.
What are the smart preprocessing errors with the Apple Developer Tools?
Smart preprocessing is activated with the -cpp-precomp 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. When compiling wxMac using the Apple Developer Tools,
the following error is displayed for certain files:
cpp-precomp: warning: errors during smart preprocessing, retrying in basic mode
This 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. This 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.
How does wxMac support the standard Apple About menu item and Help menu?
Because wxWidgets does not have a specific API for the About menu
item or the Help menu, the Mac OS port uses some static variables to
help the engine make the right decisions:
- It assumes that the About menu item is part of a Help
menu.
- The title of the Help menu is stored in
wxApp::s_macHelpMenuTitleName, it defaults to "&Help", but
you can change it in your constructor to your specific menu title.
- The item Id of the About menu is stored in
wxApp::s_macAboutMenuItemID, it defaults to wxID_ABOUT,
but can be changed as well to suit your needs.
- The other items of the wxWidgets help menu are appended to the Mac OS
Help menu and the translation of Ids is handled transparently for
your application.
How do I add an icon to my application?
If you have Mac OS X, you have the icns editor somewhere in the Utilities
folder. Create an icon using this tool and DeRez it, so that you have a .r
file with a 'icns' resource with id (-16455). Include this .r file in your
project and in the CodeWarrior Settings add a check mark under Linker:Output
Flags/Finder Flags/Has Custom Icon.
How can I easily switch between different versions of wxWidgets in CodeWarrior?
Sometimes you want to test your application against different versions of
wxWidgets, for example a stable version of wxWidgets versus a development
version. The easiest way to do this is to create a symbolic path.
Under Edit-Preferences in General:Source Trees, type a name (for example
WXWIN) and choose a path for it. Now reselect your include and lib paths for a
last time, in the settings for each configuration, but make them relative to
the symbolic name.
From now on you can just change the path associated with the symbolic
name.
Why can't I set focus to my wxMac application?
Because you didn't build your application as a bundle. You must
create a bundle for Mac OS X applications, simply running the usual g++
`wx-config --cxxflags --libs` -o minimal minimal.cpp is not
enough to build a correctly working Mac application. Please look at the
samples makefiles which do build bundles under Mac OS X or read
this wiki topic
for more details.