[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]


Correcting Linker Errors

When your project is linked, any errors that may occur can be viewed and corrected.


Viewing Linker Errors

If the linker encounters any errors while linking your project, the Message window appears indicating these errors. This window can be scrolled through by using the scroll bar or Stepping Buttons.

To learn about how to scroll through messages in the Message window, refer to "Stepping Buttons." To learn about changing the view of messages in the Message window, refer to "Seeing Errors and Warnings."


Since Linker errors are a result of problems in the object code, the CodeWarrior IDE cannot show their corresponding errors in the project's source code files.


Why Linker Errors Occur

Linker errors are usually the result of one of the following circumstances:


NOTE


(Mac OS) To find the libraries you should be using, refer to the next section, "Finding Which Library to Use (Mac OS)."


Finding Which Library to Use (Mac OS)

Often a linker error occurs when a library is missing from a project. As a result, one or more functions or identifiers cannot be found and the linker reports a problem. The difficulty you face is trying to figure out which library defines the function or identifier.

To find out which libraries or shared libraries should be added to your project, you can refer to the CodeWarrior Targeting manual appropriate for your target, as described in "Targeting Documentation". In addition, you can use the Find Library tool included on the CodeWarrior Tools CD.

Find Library is a set of files with the internal names of functions and global identifiers from many of the libraries included with the CodeWarrior IDE for Mac OS and ANSI Libraries. Use these files as a file set with the CodeWarrior IDE Find dialog box. Search for the missing identifier in these files, and you can quickly find the right library to include in your project.

Here's how to use the Find Library tool.

1. Create a File Set.

Use the Find window to create a file set that includes all the files in the Find Library folder on your CodeWarrior Tools CD. To learn how to create and use a file set, refer to "In Files".

2. Set the search parameters to ignore case.

Be sure to disable the Case sensitive checkbox in the Find window. Some identifiers may be all uppercase or lowercase.

3. Search for the symbol that the linker cannot find.

Enter the name of the unlinked symbol, and do a batch search of the Find Library file set. When the search has found a matching identifier, you only need to check the file name of the library to determine the name of the library to include in your CodeWarrior project. There is no path information given in the files, so you'll have to locate the correct library in the appropriate CodeWarrior subdirectory on your hard disk.

For example, if you do a batch search for the identifier num2dec in this file set, you'll get a match in the MathLib file. You now know that if you want to use the num2dec function, you must include the MathLib file in your project.


WARNING!

The files in the Find Library folder are just compilations of names that have been taken out of the libraries and put into a special naming file. These are not the actual library files. Do not include the `Find Library' files in your projects.

NOTE

Some names may be duplicated in more than one file. If the name has a leading period, it is probably a declaration in that file, not a definition. Be sure to use Command-G or batch search to retrieve all files with matching identifiers. Then select the appropriate library for your particular project.

Some of the 68K and PowerPC shared libraries differ slightly, although the library names are the same. To identify the correct library, we've added the suffix -68K or -PPC as appropriate. For example, DragLib is listed in the Find Library as both DragLib -68k and DragLib -PPC. Ignore the suffix when looking for the library by name, but make sure you include the correct CPU version of the library for your target platform.

The CodeWarrior IDE will report the lines on which matches occur, but you can ignore those line numbers. The line information reported is irrelevant with respect to the actual library, and refers only to the line number in the special naming file.

There are several versions of the ANSI Libraries. They all contain the same identifiers, so only one version is included. You should assume that the appropriate library for your project will contain the same functionality.

The ANSI C++ Library file will be difficult to understand because of name mangling. However, most linker errors will list a function name as well as the identifier. Searching for that function name should give you good results. For example, you might get an error message saying "__aad__9bitstringFRC9bitstring in bitsand.c" is unknown. You could either search for the mangled name or you could search for bitsand to get a match.


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: August 17, 2000