LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 01-25-2005, 04:17 PM   #1
cbranje
LQ Newbie
 
Registered: Jan 2005
Posts: 14

Rep: Reputation: 0
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
 
Old 01-25-2005, 04:31 PM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,523

Rep: Reputation: 365Reputation: 365Reputation: 365Reputation: 365
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).
 
Old 01-25-2005, 07:21 PM   #3
cbranje
LQ Newbie
 
Registered: Jan 2005
Posts: 14

Original Poster
Rep: Reputation: 0
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
 
Old 01-25-2005, 08:50 PM   #4
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,523

Rep: Reputation: 365Reputation: 365Reputation: 365Reputation: 365
Have you motif libraries and include files installed on your machine ?
 
Old 01-25-2005, 09:08 PM   #5
cbranje
LQ Newbie
 
Registered: Jan 2005
Posts: 14

Original Poster
Rep: Reputation: 0
include files??

Yeah I installed lesstif . . . what do you mean include files?
Carmen
 
Old 01-26-2005, 02:52 AM   #6
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,523

Rep: Reputation: 365Reputation: 365Reputation: 365Reputation: 365
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
 
Old 01-26-2005, 05:34 AM   #7
cbranje
LQ Newbie
 
Registered: Jan 2005
Posts: 14

Original Poster
Rep: Reputation: 0
Where do I put that??

Yes but where would I put that flag in my makefile??/

Carmen
 
Old 01-26-2005, 06:19 AM   #8
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,523

Rep: Reputation: 365Reputation: 365Reputation: 365Reputation: 365
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.

Last edited by jlliagre; 01-26-2005 at 07:11 AM.
 
Old 01-26-2005, 06:41 AM   #9
Hivemind
Member
 
Registered: Sep 2004
Posts: 273

Rep: Reputation: 30
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).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Kernel compilation error: Error 15: File not found Niceman2005 Linux - General 9 10-04-2007 04:45 AM
Error during compilation of X-WIndows on slackware-10.2 tooparam Linux - General 2 11-27-2005 11:05 PM
graphics programming in vi: using the structure REGS is giving a compilation error sohamdas Programming 1 04-26-2004 05:38 PM
Sqwebmail compilation error ... [maildirsearchC.o] Error 1 boogie_maan Linux - Software 0 10-26-2002 08:21 PM
compilation error guppy Linux - Newbie 1 06-15-2001 04:41 AM


All times are GMT -5. The time now is 02:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration