/* * This is a sample X11 program using Xt and the Athena widget set that * simply puts up a main window with the text "hello" in it. */ #include >X11/Intrinsic.h> #include <X11/StringDefs.h> #include <X11/Xaw/Label.h> int main(int argc, char* argv[]) { XtAppContext app_context; Widget toplevel, hello; toplevel = XtVaAppInitialize( &app_context, "XHello", NULL, 0, &argc, argv, NULL, NULL); hello = XtVaCreateManagedWidget("hello", labelWidgetClass, toplevel, NULL); XtRealizeWidget(toplevel); XtAppMainLoop(app_context); }build 的 command:
gcc helloxwindow.c -lXt -lXaw可以試試看後面的 -l 缺的化,各是會出現什麼Error..
Xaw:
helloxwindow.c:(.text+0x5d): undefined reference to `labelWidgetClass
Xt
undefined reference to symbol 'XtRealizeWidget'
都沒有的話:
helloxwindow.c:(.text+0x4e): undefined reference to `XtVaAppInitialize' helloxwindow.c:(.text+0x5d): undefined reference to `labelWidgetClass' helloxwindow.c:(.text+0x7a): undefined reference to `XtVaCreateManagedWidget' helloxwindow.c:(.text+0x8a): undefined reference to `XtRealizeWidget' helloxwindow.c:(.text+0x96): undefined reference to `XtAppMainLoop'
沒有留言:
張貼留言