In article <84881@palm-dev-forum>, [EMAIL PROTECTED] says...
> 
> I have a CW 8.0 project that has been compiling and building beautifully
> right up until I did the following: I had a Coord value that was being
> assigned with a #define and I changed it to a variable declared as a Coord.
> This small change produces a link error for some reason:
> 
> Link Error   : __RuntimeModule__: Entry Point '__InitCode__' is undefined.
> Project: LEDpilrc.mcp, Target: SrcEdit (debug)

Your change meant that your gClipRect was now a global variable set by 
an expression, rather than one set by a constant expression.  This is 
allowed in C++, but it generates InitCode that gets run at program start 
before your PilotMain is called.  To support this code, you need to link 
against the CodeWarrior runtime -- I think your project just has 
StartupCode.lib in it when you really need PalmOSRuntime_2i_A5.lib.

> Here are before and after snippets from the globals-and-defines area of the
> code:
> 
> *****Compiled and linked fine when I had:
> 
> #define PageHeight 143
> RectangleType gClipRect = { PageXOrigin, PageYOrigin, PageWidth, PageHeight
> };
> 
> *****Generated the error when I changed it to:
> 
> Coord PageHeight = 143; 
> RectangleType gClipRect = { PageXOrigin, PageYOrigin, PageWidth, PageHeight
> };

To avoid this, say

const Coord PageHeight = 143;

> I'm pretty new to Palm Programming and CodeWarrior, so I don't really know
> what to make of this error. I've searched the code and the CodeWarrior
> online manual to no avail for an interpretation.  There are some Linking
> errors discussed in Targetting the PalmOS from Metrowerks, but nothing about
> this particular error.

Outside the CW manual, the best discussion of the tools is at my 
palmoswerks site.  An article on the magic of __InitCode__ seems like a 
good idea -- watch for it soon.

-- 
Ben Combee <[EMAIL PROTECTED]>
CodeWarrior for Palm OS technical lead
Get help at http://palmoswerks.com/

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to