[comp.windows.x] a naive question

gjw@ANDREAS.WR.USGS.GOV (Gregory J. Woodhouse) (11/06/90)

The following example is taken directly from the O'Reilly manuals (vol. 7):

#include <xview/xview.h>
#include <xview/canvas.h>
#include <xview/scrollbar.h>

#define SCROLLBAR_KEY 100
#define MENU_KEY 200

main(argc, argv)
int argc;
char *argv[];
{
	Frame frame;
	Canvas canvas;
	Scrollbar scrollbar;
	Menu menu;
	void menu_notify_proc(), pw_event_proc();

	xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, NULL);
	frame = (Frame) xv_create(NULL, FRAME,
		FRAME_LABEL,	argv[0],
		NULL);
	canvas = (Canvas) xv_create(frame, CANVAS,
		XV_WIDTH,	300,
		XV_HEIGHT,	200,
		NULL);
	scrollbar = (Scrollbar) xv_create(canvas, SCROLLBAR,
		SCROLLBAR_DIRECTION, SCROLLBAR_VERTICAL,
		NULL);
	menu = (Menu) xv_create(canvas, MENU,
		MENU_TITLE_ITEM,	"Scrollbar",
		MENU_STRINGS,		"On", "Off", NULL,
		MENU_NOTIFY_PROC,	menu_notify_proc,
		XV_KEY_DATA,		SCROLLBAR_KEY, scrollbar,
		NULL);
	
	xv_set(canvas_paint_window(canvas),
		WIN_EVENT_PROC,		pw_event_proc,
		XV_KEY_DATA,		MENU_KEY, menu,
		NULL);
	window_fit(frame);
	window_main_loop(frame);
}

void menu_notify_proc(menu, menu_item)
Menu menu;
Menu_item menu_item;

{
char *menu_choice = (char *) xv_get(menu_item, MENU_STRING);
int show_it = !strcmp(menu_choice, "On");

xv_set(xv_get(menu, XV_KEY_DATA, SCROLLBAR_KEY),
	XV_SHOW,	show_it,
	NULL);
}

void pw_event_proc(canvas_pw, event)
Xv_Window canvas_pw;
Event *event;

{
	if (event_action(event) == ACTION_MENU && event_is_down(event)) {
		Menu menu = (Menu) xv_get(canvas_pw, XV_KEY_DATA, MENU_KEY);
		menu_show(menu, canvas_pw, event, NULL);
	}
}

--------------

When I try to compile it under SunOs 4.1 running Openwindows version 2
using the command

cc menu.c -lxview -lX11 -o menu

(again as suggested in the O'Reilly manual), I get the following runtime
error:

ld.so: call to undefined procedure _olgx_calculate_3Dcolors from 0xf779afa8

Does anyone know what I'm doing wrong and, more importantly, how to fix
the problem.
-----------------------------------------------------------------------------
Gregory Woodhouse          |We know that the center of the earth
gjw@andreas.menlo.usgs.gov |is a fiery molten mass...but it's not
(415) 329-4694 (office)    |good to dwell on it.
(415) 325-7802 (home)      |
U.S. Geological Survey / 345 Middlefield Rd. MS 977 / Menlo Park, CA 94025
-----------------------------------------------------------------------------

fgreco@dprg-330.GOVt.shearson.COM (Frank Greco) (11/08/90)

> 
> When I try to compile it under SunOs 4.1 running Openwindows version 2
> using the command
> 
> cc menu.c -lxview -lX11 -o menu
> 
> (again as suggested in the O'Reilly manual), I get the following runtime
> error:
> 
> ld.so: call to undefined procedure _olgx_calculate_3Dcolors from 0xf779afa8
> 
> Does anyone know what I'm doing wrong and, more importantly, how to fix
> the problem.


	It should be linked with the olgx libraries, and, in this order:

	cc menu -lxview -lolgx -lX11 -o menu


	Frank G.