Carbon Help

TheShitX
Unregistered
 
Post: #1
I need Help with carbon. I am running OS X 10.4 and i am using Xcode 2. I am having trouble because every time that I make an application there is an error with the Menus. I am inable to click them without the program issuing a warning:

ZeroLink: unknown symbol '__Z16doMouseDownEventv'

please could some one help me?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
It means that you haven't defined

Code:
void doMouseDownEvent()

anywhere. Is that function in one of your source files? Is it in a C++ source file? Is the C++ source file in your project? Is it ticked for the target?
Quote this message in a reply
HelloWorld
Unregistered
 
Post: #3
Sorry For the innapropriate name=(.

My code looks like this:
Code:
int main(int argc, char* argv[])
{

    IBNibRef         nibRef;
    WindowRef         window;
    WindowRef        window1;
    EventRecord     Event;
    OSStatus        err;
    EventRef        EvntRef;
    EventHandlerUPP  handlerUPP;
    Boolean         gotEvent;
    err= CreateNibReference(CFSTR("main"), &nibRef);
    
    
    err = SetMenuBarFromNib(nibRef,CFSTR("MenuBar"));
    err = CreateWindowFromNib(nibRef, CFSTR("Window2"), &window1);
    ShowWindow(window);
    ShowWindow(window1);
    SetPortWindowPort(window1);
    gQuit=false;
    
    while(!gQuit)
    {
    gotEvent = WaitNextEvent(everyEvent,&Event,MAX_UNIT32,NULL);
    if(gotEvent)
    {
    doEvents(&Event);
    }
    }
    return 0;
}


void doEvents(EventRecord * Event)
{

switch(Event->what)
{
case mouseDown:
doMouseDownEvent();
break;

case keyDown:
break;

case updateEvt:
break;

case autoKey:
break;

case activateEvt:
break;

case osEvt:
break;

case mouseUp:
break;
}
}

void doMouseDownEvent(EventRecord *EvtRec)
{
WindowPartCode  PartCode;
WindowRef       windowRef;
SInt32            menuChoice;

PartCode= FindWindow(EvtRec->where,&windowRef);

switch (PartCode)
{
case inMenuBar:
    menuChoice=MenuSelect(EvtRec->where);
    doMenuChoice(menuChoice);
    break;
    
case inContent:
    if (windowRef!=FrontWindow())
    SelectWindow(windowRef);
    break;
    
case inDrag:
    DragWindow(windowRef,EvtRec->where,NULL);
    break;

case inGoAway:
if (TrackGoAway(windowRef,EvtRec->where))
    gQuit=true;
   break;
}
}

void doMenuChoice(SInt32 MenuChoice)
{
MenuID        menuID;
MenuItemIndex MenuItem;
OSErr        err;
MenuCommand  commandID;

menuID =HiWord(MenuChoice);
MenuItem = LoWord(MenuChoice);
}


*i have not finnished with the menu, this is just handles mouse down events so far.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #4
Your function is doMouseDownEvent(EventRecord *EvtRec), but you're calling it with no arguments.
Quote this message in a reply
HelloWorld
Unregistered
 
Post: #5
Thank you Very Much!! It works now! i had also declared it inproperly in the header file.
Quote this message in a reply
Post Reply