我只想分享我如何找到错误的解决方案
没有定义实现类过程
运行 X/Motif C 应用程序时。我发布这个是因为我在网上搜索时只找到了一个关于这个问题的参考,并且它没有包含任何解决方案。
我设法解决了这个问题,如果你再次遇到这个问题,我想分享我的发现(注意:我并不是说我的解决方案总是能解决这种类型的错误)。
问题
我在运行一个使用 Motif 和 X Intrinsics 工具包的简单 C 程序时发现了这个问题。
$ gcc -Wall -c push.c
$ gcc -Wall -o push push.o -lXt -lXm
$ ./push
Error: No realize class procedure defined
C源代码如下:
#include <stdio.h>
#include <Xm/Xm.h>
#include <Xm/PushB.h>
/* Prototype Callback function */
void pushed_fn(Widget, XtPointer, XmPushButtonCallbackStruct *);
int main(int argc, char **argv)
{
Widget top_wid, button;
XtAppContext app;
Display* display;
XtToolkitInitialize();
app = XtCreateApplicationContext();
display = XtOpenDisplay(app, "localhost:10.0","push","push", NULL,0, &argc,argv);
top_wid = XtAppCreateShell(NULL, "Form", applicationShellWidgetClass, display, NULL, 0);
button = XmCreatePushButton(top_wid, "Push_me", NULL, 0);
/* tell Xt to manage button */
XtManageChild(button);
/* attach fn to widget */
XtAddCallback(button, XmNactivateCallback, (XtCallbackProc) pushed_fn, NULL);
XtRealizeWidget(top_wid); /* display widget hierarchy */
XtAppMainLoop(app); /* enter processing loop */
return 0;
}
void pushed_fn(Widget w, XtPointer client_data, XmPushButtonCallbackStruct *cbs)
{
printf("Don't Push Me!!\n");
}