Go Back   Rhinocerus > Newsgroup > Newsgroup comp.lang.c

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 02-08-2010, 09:14 PM
happytoday
Guest
 
Posts: n/a
Default compiling C program containing Xutil functions

I failed to compile that program as written below with those error
messages :
The conditions of compiling this program are not available any longer
in the net so please help me compiling this program .

Error messages :
------------------------
root @ Homer /export/home/unix.d/programs.d/clang.d/GUI>cc plot_data.c
"plot_data.c", line 15: warning: implicit function declaration:
create_int_dialog_entry
"plot_data.c", line 16: warning: implicit function declaration:
create_float_dialog_entry
"plot_data.c", line 20: warning: implicit function declaration:
set_up_dialog
"plot_data.c", line 24: warning: implicit function declaration:
read_dialog_window
Undefined first referenced
symbol in file
create_int_dialog_entry plot_data.o
create_float_dialog_entry plot_data.o
read_dialog_window plot_data.o
set_up_dialog plot_data.o
ld: fatal: Symbol referencing errors. No output written to a.out


Sources code :
------------------------
#include </usr/openwin/share/include/X11/Xlib.h>
#include </usr/openwin/share/include/X11/Xutil.h>
#include <stdio.h>
#include <math.h>

int main()
{
/* Define default values: */

int n = 0;
float x = 0.0;

/* Define contents of dialog window */

create_int_dialog_entry("n", &n);
create_float_dialog_entry("x", &x);

/* Create window with name "Setup" and top-left corner at (0,0) */

set_up_dialog("Setup", 0, 0);

/* Display the window and read the results */

read_dialog_window();

/* Print out the new values */

printf("n = %d, x = %f\n", n, x);
return 0;
}
Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 02-08-2010, 09:24 PM
John Gordon
Guest
 
Posts: n/a
Default Re: compiling C program containing Xutil functions

In <9066f742-5021-4fe6-a2dd-9c408115b99a@d37g2000yqa.googlegroups.com> happytoday <ehabaziz2001@gmail.com> writes:

> I failed to compile that program as written below with those error
> messages :
> The conditions of compiling this program are not available any longer
> in the net so please help me compiling this program .


Your code is calling several functions that are not part of the standard
C library. You must provide a library which contains those funcitons.

--
John Gordon A is for Amy, who fell down the stairs
gordon@panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"

Reply With Quote
  #3 (permalink)  
Old 02-08-2010, 09:27 PM
Ian Collins
Guest
 
Posts: n/a
Default Re: compiling C program containing Xutil functions

happytoday wrote:
> I failed to compile that program as written below with those error
> messages :
> The conditions of compiling this program are not available any longer
> in the net so please help me compiling this program .


You asked this in on c.l.c 2006, the same answers apply.

--
Ian Collins
Reply With Quote
  #4 (permalink)  
Old 02-08-2010, 09:30 PM
toucan
Guest
 
Posts: n/a
Default Re: compiling C program containing Xutil functions

happytoday wrote:
> I failed to compile that program as written below with those error
> messages :
> The conditions of compiling this program are not available any longer
> in the net so please help me compiling this program .
>
> Error messages :
> ------------------------
> root @ Homer /export/home/unix.d/programs.d/clang.d/GUI>cc plot_data.c
> "plot_data.c", line 15: warning: implicit function declaration:
> create_int_dialog_entry
> "plot_data.c", line 16: warning: implicit function declaration:
> create_float_dialog_entry
> "plot_data.c", line 20: warning: implicit function declaration:
> set_up_dialog
> "plot_data.c", line 24: warning: implicit function declaration:
> read_dialog_window
> Undefined first referenced
> symbol in file
> create_int_dialog_entry plot_data.o
> create_float_dialog_entry plot_data.o
> read_dialog_window plot_data.o
> set_up_dialog plot_data.o
> ld: fatal: Symbol referencing errors. No output written to a.out
>
>
> Sources code :
> ------------------------
> #include </usr/openwin/share/include/X11/Xlib.h>
> #include </usr/openwin/share/include/X11/Xutil.h>


It would be better to write
#include <X11/Xlib.h>
#include <X11/Xutil.h>

then, probably something like the following, assuming your
lib files are in /usr/openwin/lib (e.g. libXlib.a if it's
the correct name for your library)
cc -I/usr/openwin/share/include -L/usr/openwin/lib -lXlib -lXutil



> #include <stdio.h>
> #include <math.h>
>
> int main()
> {
> /* Define default values: */
>
> int n = 0;
> float x = 0.0;
>
> /* Define contents of dialog window */
>
> create_int_dialog_entry("n", &n);
> create_float_dialog_entry("x", &x);
>
> /* Create window with name "Setup" and top-left corner at (0,0) */
>
> set_up_dialog("Setup", 0, 0);
>
> /* Display the window and read the results */
>
> read_dialog_window();
>
> /* Print out the new values */
>
> printf("n = %d, x = %f\n", n, x);
> return 0;
> }

Reply With Quote
  #5 (permalink)  
Old 02-08-2010, 09:47 PM
Richard B. Gilbert
Guest
 
Posts: n/a
Default Re: compiling C program containing Xutil functions

happytoday wrote:
> I failed to compile that program as written below with those error
> messages :
> The conditions of compiling this program are not available any longer
> in the net so please help me compiling this program .
>
> Error messages :
> ------------------------
> root @ Homer /export/home/unix.d/programs.d/clang.d/GUI>cc plot_data.c
> "plot_data.c", line 15: warning: implicit function declaration:
> create_int_dialog_entry
> "plot_data.c", line 16: warning: implicit function declaration:
> create_float_dialog_entry
> "plot_data.c", line 20: warning: implicit function declaration:
> set_up_dialog
> "plot_data.c", line 24: warning: implicit function declaration:
> read_dialog_window


Your REALLY should declare your functions! This will tell the compiler
what sort of things should be passed to the functions as arguments and
the type of the the value returned by the function.

K&R C, which allowed you to omit such things, is hopelessly obsolete.

> Undefined first referenced
> symbol in file
> create_int_dialog_entry plot_data.o
> create_float_dialog_entry plot_data.o
> read_dialog_window plot_data.o
> set_up_dialog plot_data.o
> ld: fatal: Symbol referencing errors. No output written to a.out
>
>
> Sources code :
> ------------------------
> #include </usr/openwin/share/include/X11/Xlib.h>
> #include </usr/openwin/share/include/X11/Xutil.h>
> #include <stdio.h>
> #include <math.h>
>
> int main()
> {
> /* Define default values: */
>
> int n = 0;
> float x = 0.0;
>
> /* Define contents of dialog window */
>
> create_int_dialog_entry("n", &n);


It's conventional, though not required, for a function like the above to
return "success" or "failure". Good programmers test the return code
and write diagnostic messages when a function returns a failure code.

> create_float_dialog_entry("x", &x);

Test the return code!
>
> /* Create window with name "Setup" and top-left corner at (0,0) */
>
> set_up_dialog("Setup", 0, 0);

Test the return code!
>
> /* Display the window and read the results */
>
> read_dialog_window();
>
> /* Print out the new values */
>
> printf("n = %d, x = %f\n", n, x);
> return 0;
> }


Dirty little hacks like this have a nasty habit of turning up as part of
something important and embarrassing the authors!

If it's worth doing, it's worth doing it well!!
Reply With Quote
  #6 (permalink)  
Old 02-08-2010, 10:08 PM
happytoday
Guest
 
Posts: n/a
Default Re: compiling C program containing Xutil functions

On Feb 9, 12:30*am, toucan <tou...@zoo.invalid> wrote:
> happytoday wrote:
> > I failed to compile that program as written below with those error
> > messages :
> > The conditions of compiling this program are not available any longer
> > in the net so please help me compiling this program .

>
> > Error messages :
> > ------------------------
> > root @ Homer /export/home/unix.d/programs.d/clang.d/GUI>cc plot_data.c
> > "plot_data.c", line 15: warning: implicit function declaration:
> > create_int_dialog_entry
> > "plot_data.c", line 16: warning: implicit function declaration:
> > create_float_dialog_entry
> > "plot_data.c", line 20: warning: implicit function declaration:
> > set_up_dialog
> > "plot_data.c", line 24: warning: implicit function declaration:
> > read_dialog_window
> > Undefined * * * * * * * * * * * first referenced
> > *symbol * * * * * * * * * * * * * * in file
> > create_int_dialog_entry * * * * * * plot_data.o
> > create_float_dialog_entry * * * * * plot_data.o
> > read_dialog_window * * * * * * * * *plot_data.o
> > set_up_dialog * * * * * * * * * * * plot_data.o
> > ld: fatal: Symbol referencing errors. No output written to a.out

>
> > Sources code :
> > ------------------------
> > #include </usr/openwin/share/include/X11/Xlib.h>
> > #include </usr/openwin/share/include/X11/Xutil.h>

>
> It would be better to write
> #include <X11/Xlib.h>
> #include <X11/Xutil.h>
>
> then, probably something like the following, assuming your
> lib files are in /usr/openwin/lib (e.g. libXlib.a if it's
> the correct name for your library)
> cc -I/usr/openwin/share/include -L/usr/openwin/lib -lXlib -lXutil
>
> > #include <stdio.h>
> > #include <math.h>

>
> > int main()
> > {
> > /* Define default values: */

>
> > int n = 0;
> > float x = 0.0;

>
> > /* Define contents of dialog window */

>
> > create_int_dialog_entry("n", &n);
> > create_float_dialog_entry("x", &x);

>
> > /* Create window with name "Setup" and top-left corner at (0,0) */

>
> > set_up_dialog("Setup", 0, 0);

>
> > /* Display the window and read the results */

>
> > read_dialog_window();

>
> > /* Print out the new values */

>
> > printf("n = %d, x = %f\n", n, x);
> > return 0;
> > }

>
>


The problem that I did know well what files concerning these functions
so I compiled with the below errors :
root @ Homer /clang>head plot_data.c
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <stdio.h>
#include <math.h>

int main()
{
/* Define default values: */

int n = 0;
root @ Homer /clang>


root @ Homer /clang>cc -I/usr/openwin/share/include -L/usr/openwin/lib
-lXlib -lXutil plot_data.c
"plot_data.c", line 15: warning: implicit function declaration:
create_int_dialog_entry
"plot_data.c", line 16: warning: implicit function declaration:
create_float_dialog_entry
"plot_data.c", line 20: warning: implicit function declaration:
set_up_dialog
"plot_data.c", line 24: warning: implicit function declaration:
read_dialog_window
ld: fatal: library -lXlib: not found
ld: fatal: library -lXutil: not found
ld: fatal: File processing errors. No output written to a.out
Reply With Quote
  #7 (permalink)  
Old 02-08-2010, 10:10 PM
happytoday
Guest
 
Posts: n/a
Default Re: compiling C program containing Xutil functions

On Feb 9, 12:30*am, toucan <tou...@zoo.invalid> wrote:
> happytoday wrote:
> > I failed to compile that program as written below with those error
> > messages :
> > The conditions of compiling this program are not available any longer
> > in the net so please help me compiling this program .

>
> > Error messages :
> > ------------------------
> > root @ Homer /export/home/unix.d/programs.d/clang.d/GUI>cc plot_data.c
> > "plot_data.c", line 15: warning: implicit function declaration:
> > create_int_dialog_entry
> > "plot_data.c", line 16: warning: implicit function declaration:
> > create_float_dialog_entry
> > "plot_data.c", line 20: warning: implicit function declaration:
> > set_up_dialog
> > "plot_data.c", line 24: warning: implicit function declaration:
> > read_dialog_window
> > Undefined * * * * * * * * * * * first referenced
> > *symbol * * * * * * * * * * * * * * in file
> > create_int_dialog_entry * * * * * * plot_data.o
> > create_float_dialog_entry * * * * * plot_data.o
> > read_dialog_window * * * * * * * * *plot_data.o
> > set_up_dialog * * * * * * * * * * * plot_data.o
> > ld: fatal: Symbol referencing errors. No output written to a.out

>
> > Sources code :
> > ------------------------
> > #include </usr/openwin/share/include/X11/Xlib.h>
> > #include </usr/openwin/share/include/X11/Xutil.h>

>
> It would be better to write
> #include <X11/Xlib.h>
> #include <X11/Xutil.h>
>
> then, probably something like the following, assuming your
> lib files are in /usr/openwin/lib (e.g. libXlib.a if it's
> the correct name for your library)
> cc -I/usr/openwin/share/include -L/usr/openwin/lib -lXlib -lXutil
>
> > #include <stdio.h>
> > #include <math.h>

>
> > int main()
> > {
> > /* Define default values: */

>
> > int n = 0;
> > float x = 0.0;

>
> > /* Define contents of dialog window */

>
> > create_int_dialog_entry("n", &n);
> > create_float_dialog_entry("x", &x);

>
> > /* Create window with name "Setup" and top-left corner at (0,0) */

>
> > set_up_dialog("Setup", 0, 0);

>
> > /* Display the window and read the results */

>
> > read_dialog_window();

>
> > /* Print out the new values */

>
> > printf("n = %d, x = %f\n", n, x);
> > return 0;
> > }

>
>


The problem that I do not know what library files should be included
to resolve these functions
so I compiled with the below errors :

root @ Homer /clang>head plot_data.c
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <stdio.h>
#include <math.h>

int main()
{
/* Define default values: */

int n = 0;
root @ Homer /clang>

root @ Homer /clang>cc -I/usr/openwin/share/include -L/usr/openwin/lib
-lXlib -lXutil plot_data.c
"plot_data.c", line 15: warning: implicit function declaration:
create_int_dialog_entry
"plot_data.c", line 16: warning: implicit function declaration:
create_float_dialog_entry
"plot_data.c", line 20: warning: implicit function declaration:
set_up_dialog
"plot_data.c", line 24: warning: implicit function declaration:
read_dialog_window
ld: fatal: library -lXlib: not found
ld: fatal: library -lXutil: not found
ld: fatal: File processing errors. No output written to a.out
Reply With Quote
  #8 (permalink)  
Old 02-09-2010, 12:36 AM
Ian Collins
Guest
 
Posts: n/a
Default Re: compiling C program containing Xutil functions

happytoday wrote:
>
> The problem that I did know well what files concerning these functions
> so I compiled with the below errors


How did you resolve them in 2006?

--
Ian Collins
Reply With Quote
  #9 (permalink)  
Old 02-09-2010, 02:28 PM
Fred
Guest
 
Posts: n/a
Default Re: compiling C program containing Xutil functions

On Feb 8, 3:10*pm, happytoday <ehabaziz2...@gmail.com> wrote:
> On Feb 9, 12:30*am, toucan <tou...@zoo.invalid> wrote:
>
>
>
>
>
> > happytoday wrote:
> > > I failed to compile that program as written below with those error
> > > messages :
> > > The conditions of compiling this program are not available any longer
> > > in the net so please help me compiling this program .

>
> > > Error messages :
> > > ------------------------
> > > root @ Homer /export/home/unix.d/programs.d/clang.d/GUI>cc plot_data.c
> > > "plot_data.c", line 15: warning: implicit function declaration:
> > > create_int_dialog_entry
> > > "plot_data.c", line 16: warning: implicit function declaration:
> > > create_float_dialog_entry
> > > "plot_data.c", line 20: warning: implicit function declaration:
> > > set_up_dialog
> > > "plot_data.c", line 24: warning: implicit function declaration:
> > > read_dialog_window
> > > Undefined * * * * * * * * * * * first referenced
> > > *symbol * * * * * * * * * * * * * * in file
> > > create_int_dialog_entry * * * * * * plot_data.o
> > > create_float_dialog_entry * * * * * plot_data.o
> > > read_dialog_window * * * * * * * * *plot_data.o
> > > set_up_dialog * * * * * * * * * * * plot_data.o
> > > ld: fatal: Symbol referencing errors. No output written to a.out

>
> > > Sources code :
> > > ------------------------
> > > #include </usr/openwin/share/include/X11/Xlib.h>
> > > #include </usr/openwin/share/include/X11/Xutil.h>

>
> > It would be better to write
> > #include <X11/Xlib.h>
> > #include <X11/Xutil.h>

>
> > then, probably something like the following, assuming your
> > lib files are in /usr/openwin/lib (e.g. libXlib.a if it's
> > the correct name for your library)
> > cc -I/usr/openwin/share/include -L/usr/openwin/lib -lXlib -lXutil

>
> > > #include <stdio.h>
> > > #include <math.h>

>
> > > int main()
> > > {
> > > /* Define default values: */

>
> > > int n = 0;
> > > float x = 0.0;

>
> > > /* Define contents of dialog window */

>
> > > create_int_dialog_entry("n", &n);
> > > create_float_dialog_entry("x", &x);

>
> > > /* Create window with name "Setup" and top-left corner at (0,0) */

>
> > > set_up_dialog("Setup", 0, 0);

>
> > > /* Display the window and read the results */

>
> > > read_dialog_window();

>
> > > /* Print out the new values */

>
> > > printf("n = %d, x = %f\n", n, x);
> > > return 0;
> > > }

>
> The problem that I do not know what library files should be included
> to resolve these functions
> so I compiled with the below errors :
>
> root @ Homer /clang>head plot_data.c
> #include <X11/Xlib.h>
> #include <X11/Xutil.h>
> #include <stdio.h>
> #include <math.h>
>
> int main()
> {
> /* Define default values: */
>
> int n = 0;
> root @ Homer /clang>
>
> root @ Homer /clang>cc -I/usr/openwin/share/include -L/usr/openwin/lib
> -lXlib -lXutil plot_data.c


Are you sure you want "-I/usr/openwin/share/include" instead of
"-L/usr/openwin/share/include" ?

Where are libX11.aand libXutil.a on your system?

In my experience, Sun Unix platforms put them in "/usr/openwin",
while most other -nix platforms put them (or at least links to them)
in /usr/lib or /usr/X11R6.

You need to find where thosw libraries are on your system, and
set the "-L" options appropriately to point to them.

> "plot_data.c", line 15: warning: implicit function declaration:
> create_int_dialog_entry


Line 15 of your source code apparently references a function
named "create_int_directory_entry" without you having provided
a prototype for that function.

> "plot_data.c", line 16: warning: implicit function declaration:
> create_float_dialog_entry
> "plot_data.c", line 20: warning: implicit function declaration:
> set_up_dialog
> "plot_data.c", line 24: warning: implicit function declaration:
> read_dialog_window


Ditto for these warnings.

> ld: fatal: library -lXlib: not found
> ld: fatal: library -lXutil: not found


libXlib.a and libXutil.a could not be found in the paths you provided.

> ld: fatal: File processing errors. No output written to a.out- Hide quoted text -
>
> - Show quoted text -


--
Fred K
Reply With Quote
  #10 (permalink)  
Old 02-09-2010, 04:11 PM
toucan
Guest
 
Posts: n/a
Default Re: compiling C program containing Xutil functions

happytoday wrote:

> The problem that I did know well what files concerning these functions
> so I compiled with the below errors :
> root @ Homer /clang>head plot_data.c
> #include <X11/Xlib.h>
> #include <X11/Xutil.h>
> #include <stdio.h>
> #include <math.h>
>
> int main()
> {
> /* Define default values: */
>
> int n = 0;
> root @ Homer /clang>
>
>
> root @ Homer /clang>cc -I/usr/openwin/share/include -L/usr/openwin/lib
> -lXlib -lXutil plot_data.c
> "plot_data.c", line 15: warning: implicit function declaration:
> create_int_dialog_entry
> "plot_data.c", line 16: warning: implicit function declaration:
> create_float_dialog_entry
> "plot_data.c", line 20: warning: implicit function declaration:
> set_up_dialog
> "plot_data.c", line 24: warning: implicit function declaration:
> read_dialog_window
> ld: fatal: library -lXlib: not found
> ld: fatal: library -lXutil: not found
> ld: fatal: File processing errors. No output written to a.out


It looks like something is wrong : did you check the "implicitly
declared" function are really in those header files ? Did you check
the lib file are really in this directory ?
Reply With Quote
  #11 (permalink)  
Old 02-12-2010, 08:41 PM
happytoday
Guest
 
Posts: n/a
Default Re: compiling C program containing Xutil functions

On Feb 9, 5:28*pm, Fred <fred.l.kleinschm...@boeing.com> wrote:
> On Feb 8, 3:10*pm, happytoday <ehabaziz2...@gmail.com> wrote:
>
>
>
> > On Feb 9, 12:30*am, toucan <tou...@zoo.invalid> wrote:

>
> > > happytoday wrote:
> > > > I failed to compile that program as written below with those error
> > > > messages :
> > > > The conditions of compiling this program are not available any longer
> > > > in the net so please help me compiling this program .

>
> > > > Error messages :
> > > > ------------------------
> > > > root @ Homer /export/home/unix.d/programs.d/clang.d/GUI>cc plot_data.c
> > > > "plot_data.c", line 15: warning: implicit function declaration:
> > > > create_int_dialog_entry
> > > > "plot_data.c", line 16: warning: implicit function declaration:
> > > > create_float_dialog_entry
> > > > "plot_data.c", line 20: warning: implicit function declaration:
> > > > set_up_dialog
> > > > "plot_data.c", line 24: warning: implicit function declaration:
> > > > read_dialog_window
> > > > Undefined * * * * * * * * * * * first referenced
> > > > *symbol * * * * * * * * * * * * * * in file
> > > > create_int_dialog_entry * * * * * * plot_data.o
> > > > create_float_dialog_entry * * * * * plot_data.o
> > > > read_dialog_window * * * * * * * * *plot_data.o
> > > > set_up_dialog * * * * * * * * * * * plot_data..o
> > > > ld: fatal: Symbol referencing errors. No output written to a.out

>
> > > > Sources code :
> > > > ------------------------
> > > > #include </usr/openwin/share/include/X11/Xlib.h>
> > > > #include </usr/openwin/share/include/X11/Xutil.h>

>
> > > It would be better to write
> > > #include <X11/Xlib.h>
> > > #include <X11/Xutil.h>

>
> > > then, probably something like the following, assuming your
> > > lib files are in /usr/openwin/lib (e.g. libXlib.a if it's
> > > the correct name for your library)
> > > cc -I/usr/openwin/share/include -L/usr/openwin/lib -lXlib -lXutil

>
> > > > #include <stdio.h>
> > > > #include <math.h>

>
> > > > int main()
> > > > {
> > > > /* Define default values: */

>
> > > > int n = 0;
> > > > float x = 0.0;

>
> > > > /* Define contents of dialog window */

>
> > > > create_int_dialog_entry("n", &n);
> > > > create_float_dialog_entry("x", &x);

>
> > > > /* Create window with name "Setup" and top-left corner at (0,0) */

>
> > > > set_up_dialog("Setup", 0, 0);

>
> > > > /* Display the window and read the results */

>
> > > > read_dialog_window();

>
> > > > /* Print out the new values */

>
> > > > printf("n = %d, x = %f\n", n, x);
> > > > return 0;
> > > > }

>
> > The problem that I do not know what library files should be included
> > to resolve these functions
> > so I compiled with the below errors :

>
> > root @ Homer /clang>head plot_data.c
> > #include <X11/Xlib.h>
> > #include <X11/Xutil.h>
> > #include <stdio.h>
> > #include <math.h>

>
> > int main()
> > {
> > /* Define default values: */

>
> > int n = 0;
> > root @ Homer /clang>

>
> > root @ Homer /clang>cc -I/usr/openwin/share/include -L/usr/openwin/lib
> > -lXlib -lXutil plot_data.c

>
> Are you sure you want "-I/usr/openwin/share/include" instead of
> "-L/usr/openwin/share/include" ?
>
> Where are libX11.aand libXutil.a on your system?
>
> In my experience, Sun Unix platforms put them in "/usr/openwin",
> while most other -nix platforms put them (or at least links to them)
> in /usr/lib or /usr/X11R6.
>
> You need to find where thosw libraries are on your system, and
> set the "-L" options appropriately to point to them.
>
> > "plot_data.c", line 15: warning: implicit function declaration:
> > create_int_dialog_entry

>
> Line 15 of your source code apparently references a function
> named "create_int_directory_entry" without you having provided
> a prototype for that function.
>
> > "plot_data.c", line 16: warning: implicit function declaration:
> > create_float_dialog_entry
> > "plot_data.c", line 20: warning: implicit function declaration:
> > set_up_dialog
> > "plot_data.c", line 24: warning: implicit function declaration:
> > read_dialog_window

>
> Ditto for these warnings.
>
> > ld: fatal: library -lXlib: not found
> > ld: fatal: library -lXutil: not found

>
> libXlib.a and libXutil.a could not be found in the paths you provided.
>
> > ld: fatal: File processing errors. No output written to a.out- Hide quoted text -

>
> > - Show quoted text -

>
> --
> Fred K


Please visit this page and see what the examples written about
Graphical Interfaces: Dialog Boxes example :
http://docs.huihoo.com/gnu/c-basics/c_tutorial.html
Reply With Quote
  #12 (permalink)  
Old 02-12-2010, 08:41 PM
happytoday
Guest
 
Posts: n/a
Default Re: compiling C program containing Xutil functions

On Feb 9, 5:28*pm, Fred <fred.l.kleinschm...@boeing.com> wrote:
> On Feb 8, 3:10*pm, happytoday <ehabaziz2...@gmail.com> wrote:
>
>
>
> > On Feb 9, 12:30*am, toucan <tou...@zoo.invalid> wrote:

>
> > > happytoday wrote:
> > > > I failed to compile that program as written below with those error
> > > > messages :
> > > > The conditions of compiling this program are not available any longer
> > > > in the net so please help me compiling this program .

>
> > > > Error messages :
> > > > ------------------------
> > > > root @ Homer /export/home/unix.d/programs.d/clang.d/GUI>cc plot_data.c
> > > > "plot_data.c", line 15: warning: implicit function declaration:
> > > > create_int_dialog_entry
> > > > "plot_data.c", line 16: warning: implicit function declaration:
> > > > create_float_dialog_entry
> > > > "plot_data.c", line 20: warning: implicit function declaration:
> > > > set_up_dialog
> > > > "plot_data.c", line 24: warning: implicit function declaration:
> > > > read_dialog_window
> > > > Undefined * * * * * * * * * * * first referenced
> > > > *symbol * * * * * * * * * * * * * * in file
> > > > create_int_dialog_entry * * * * * * plot_data.o
> > > > create_float_dialog_entry * * * * * plot_data.o
> > > > read_dialog_window * * * * * * * * *plot_data.o
> > > > set_up_dialog * * * * * * * * * * * plot_data..o
> > > > ld: fatal: Symbol referencing errors. No output written to a.out

>
> > > > Sources code :
> > > > ------------------------
> > > > #include </usr/openwin/share/include/X11/Xlib.h>
> > > > #include </usr/openwin/share/include/X11/Xutil.h>

>
> > > It would be better to write
> > > #include <X11/Xlib.h>
> > > #include <X11/Xutil.h>

>
> > > then, probably something like the following, assuming your
> > > lib files are in /usr/openwin/lib (e.g. libXlib.a if it's
> > > the correct name for your library)
> > > cc -I/usr/openwin/share/include -L/usr/openwin/lib -lXlib -lXutil

>
> > > > #include <stdio.h>
> > > > #include <math.h>

>
> > > > int main()
> > > > {
> > > > /* Define default values: */

>
> > > > int n = 0;
> > > > float x = 0.0;

>
> > > > /* Define contents of dialog window */

>
> > > > create_int_dialog_entry("n", &n);
> > > > create_float_dialog_entry("x", &x);

>
> > > > /* Create window with name "Setup" and top-left corner at (0,0) */

>
> > > > set_up_dialog("Setup", 0, 0);

>
> > > > /* Display the window and read the results */

>
> > > > read_dialog_window();

>
> > > > /* Print out the new values */

>
> > > > printf("n = %d, x = %f\n", n, x);
> > > > return 0;
> > > > }

>
> > The problem that I do not know what library files should be included
> > to resolve these functions
> > so I compiled with the below errors :

>
> > root @ Homer /clang>head plot_data.c
> > #include <X11/Xlib.h>
> > #include <X11/Xutil.h>
> > #include <stdio.h>
> > #include <math.h>

>
> > int main()
> > {
> > /* Define default values: */

>
> > int n = 0;
> > root @ Homer /clang>

>
> > root @ Homer /clang>cc -I/usr/openwin/share/include -L/usr/openwin/lib
> > -lXlib -lXutil plot_data.c

>
> Are you sure you want "-I/usr/openwin/share/include" instead of
> "-L/usr/openwin/share/include" ?
>
> Where are libX11.aand libXutil.a on your system?
>
> In my experience, Sun Unix platforms put them in "/usr/openwin",
> while most other -nix platforms put them (or at least links to them)
> in /usr/lib or /usr/X11R6.
>
> You need to find where thosw libraries are on your system, and
> set the "-L" options appropriately to point to them.
>
> > "plot_data.c", line 15: warning: implicit function declaration:
> > create_int_dialog_entry

>
> Line 15 of your source code apparently references a function
> named "create_int_directory_entry" without you having provided
> a prototype for that function.
>
> > "plot_data.c", line 16: warning: implicit function declaration:
> > create_float_dialog_entry
> > "plot_data.c", line 20: warning: implicit function declaration:
> > set_up_dialog
> > "plot_data.c", line 24: warning: implicit function declaration:
> > read_dialog_window

>
> Ditto for these warnings.
>
> > ld: fatal: library -lXlib: not found
> > ld: fatal: library -lXutil: not found

>
> libXlib.a and libXutil.a could not be found in the paths you provided.
>
> > ld: fatal: File processing errors. No output written to a.out- Hide quoted text -

>
> > - Show quoted text -

>
> --
> Fred K


Please visit this page and see what the examples written about
Graphical Interfaces: Dialog Boxes example :
http://docs.huihoo.com/gnu/c-basics/c_tutorial.html
Reply With Quote
  #13 (permalink)  
Old 02-16-2010, 10:57 PM
Flash Gordon
Guest
 
Posts: n/a
Default Re: compiling C program containing Xutil functions

happytoday wrote:

<snip>

> Please visit this page and see what the examples written about
> Graphical Interfaces: Dialog Boxes example :
> http://docs.huihoo.com/gnu/c-basics/c_tutorial.html


Or better yet, don't use that tutorial. Apart from using "void main" it
lists strncpy as one of the most useful string functions (it's use is
highly specialised), it keeps having a space after the < of #include
directives, it keeps saying statement blocks are required where you can
alternatively use a single statement (although sometimes it does not
bother with the block it says you need when initially describing the
construct)...

That's what a cursory skim through shows.
--
Flash Gordon
Reply With Quote
 
Reply

Popular Tags in the Forum
compiling, functions, program, xutil

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[ANN] Filtered functions Pascal Costanza Newsgroup comp.lang.lisp 213 12-25-2009 10:12 PM
tags program that determines first and last line of Scheme functions? Sven Hartrumpf Newsgroup comp.lang.scheme 0 10-08-2009 07:48 AM
tapitin#include<windows.stdio.h> [LINK] == http://www.meami.org Newsgroup comp.lang.java.programmer 0 10-07-2009 05:18 PM
FAQ: comp.lang.pascal.delphi.misc miniFAQ (full version) Evil miniFAQ Boss Newsgroup comp.lang.pascal.delphi.misc 0 04-01-2009 02:00 AM
Re: How to Run a SAS program at given Calender date and time? Pardee, Roy Newsgroup comp.soft-sys.sas 0 06-21-2007 04:02 PM



All times are GMT. The time now is 04:28 PM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.