From: happytoday on
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;
}
From: John Gordon on
In <9066f742-5021-4fe6-a2dd-9c408115b99a(a)d37g2000yqa.googlegroups.com> happytoday <ehabaziz2001(a)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(a)panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"

From: Ian Collins on
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
From: toucan on
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;
> }
From: Richard B. Gilbert on
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!!