X Windows Programming Compilation Error
Hi i'm trying to compile a x windows program and I'm getting these errors, any hints off hand?
alpha_list.c:3:21: Xm/List.h: No such file or directory alpha_list.c:4:26: Xm/RowColumn.h: No such file or directory alpha_list.c:5:22: Xm/TextF.h: No such file or directory alpha_list.c:7: error: parse error before "charset" alpha_list.c:7: error: `XmSTRING_DEFAULT_CHARSET' undeclared here (not in a function) alpha_list.c:7: warning: data definition has no type or storage class alpha_list.c: In function `main': alpha_list.c:12: error: `Widget' undeclared (first use in this function) alpha_list.c:12: error: (Each undeclared identifier is reported only once alpha_list.c:12: error: for each function it appears in.) alpha_list.c:12: error: parse error before "toplevel" alpha_list.c:13: error: `XtAppContext' undeclared (first use in this function) alpha_list.c:14: error: `Arg' undeclared (first use in this function) alpha_list.c:17: error: `toplevel' undeclared (first use in this function) alpha_list.c:17: error: `app' undeclared (first use in this function) alpha_list.c:17: error: `NULL' undeclared (first use in this function) alpha_list.c:20: error: `rowcol' undeclared (first use in this function) alpha_list.c:21: error: `xmRowColumnWidgetClass' undeclared (first use in this function) alpha_list.c:23: error: `args' undeclared (first use in this function) alpha_list.c:23: error: `XmNvisibleItemCount' undeclared (first use in this function) alpha_list.c:24: error: `list_w' undeclared (first use in this function) alpha_list.c:27: error: `text_w' undeclared (first use in this function) alpha_list.c:28: error: `xmTextFieldWidgetClass' undeclared (first use in this function) alpha_list.c:29: error: `XmNcolumns' undeclared (first use in this function) alpha_list.c:31: error: `XmNactivateCallback' undeclared (first use in this function) alpha_list.c: At top level: alpha_list.c:44: error: parse error before "Widget" alpha_list.c:44: error: `text_w' used prior to declaration alpha_list.c:44: error: `list_w' used prior to declaration alpha_list.c:44: warning: data definition has no type or storage class alpha_list.c:45: error: parse error before '{' token alpha_list.c:47: warning: data definition has no type or storage class alpha_list.c:51: error: parse error before "if" alpha_list.c:58: error: parse error before '&' token alpha_list.c:60: warning: data definition has no type or storage class alpha_list.c:61: error: parse error before '--' token alpha_list.c:72: warning: parameter names (without types) in function declaration alpha_list.c:72: warning: data definition has no type or storage class alpha_list.c:73: error: parse error before '}' token alpha_list.c:74: error: `newtext' undeclared here (not in a function) alpha_list.c:74: error: initializer element is not constant alpha_list.c:74: warning: data definition has no type or storage class alpha_list.c:75: warning: parameter names (without types) in function declaration alpha_list.c:75: warning: data definition has no type or storage class alpha_list.c:77: error: parse error before '+' token alpha_list.c:77: warning: data definition has no type or storage class alpha_list.c:78: warning: parameter names (without types) in function declaration alpha_list.c:78: warning: data definition has no type or storage class alpha_list.c:79: error: parse error before string constant alpha_list.c:79: warning: data definition has no type or storage class make: *** [alpha_list.o] Error 1 Thanks Carmen Branje Toronto |
The hint is the first error line:
alpha_list.c:3:21: Xm/List.h: No such file or directory You need to pass an option to your compiler for it to be able to find the X11 include files, should you have it already installed. If you haven't, you first need to install the right package: looks like your program is using motif, so you need to install motif devlopment or equivalent (lesstif). |
How do I include that path in this imake file?
How would I do that in this file??
SRCS1= alpha_list.c OBJS1= alpha_list.o SRCS2= list_callback.c OBJS2= list_callback.o SRCS3= scrolled_list.c OBJS3= scrolled_list.o SRCS4= search_list.c OBJS4= search_list.o SRCS5= simple_list.c OBJS5= simple_list.o PROGRAMS = alpha_list list_callback scrolled_list search_list simple_list SYS_LIBRARIES = $(XLIB) $(XTOOLLIB) LOCAL_LIBRARIES = -lXm AllTarget($(PROGRAMS)) NormalProgramTarget(alpha_list,$(OBJS1),,$(LOCAL_LIBRARIES),) NormalProgramTarget(list_callback,$(OBJS2),,$(LOCAL_LIBRARIES),) NormalProgramTarget(scrolled_list,$(OBJS3),,$(LOCAL_LIBRARIES),) NormalProgramTarget(search_list,$(OBJS4),,$(LOCAL_LIBRARIES),) NormalProgramTarget(simple_list,$(OBJS5),,$(LOCAL_LIBRARIES),) Thanks carmen |
Have you motif libraries and include files installed on your machine ?
|
include files??
Yeah I installed lesstif . . . what do you mean include files?
Carmen |
Libraries are binary files with a ".a" or ".so" extension.
Include files are having a ".h" extension and are included in C or C++ code with the "#include" preprocessor (compiler) directive. You likely need to add something like "-L/usr/local/lib" to the Makefile compiler flags, see: http://www.lesstif.org/FAQ.html#QU5.0 |
Where do I put that??
Yes but where would I put that flag in my makefile??/
Carmen |
Look for variables like CFLAGS having the "-lXm" string, and add the correct -L flag to the whole.
Unfortunately, you may face other issues later if the program you are trying to build was written a long time ago. |
As jlliagre says, the linker must be able to find the libraries you're trying to use if linking is to be successful.
But you're having a compilation error and, as has been pointed out, posting a large mass of compilation errors is not that meaningful. Instead, you should focus on the very first error: the header file that cannot be found. Determine where that header is on your system and pass -I/path/to/header when *compiling* so the compiler can find it. Compilation options are set in CFLAGS (or CXXFLAGS for c++ programs). |
All times are GMT -5. The time now is 01:12 AM. |