How can I Compile this program using the alias Cgfx

ehabaziz2001

Distinguished
Mar 9, 2010
3
0
18,510
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);
}

Compile this program using the alias Cgfx (see the page on compilation) to link in all necessary libraries.
 

linux_0

Splendid
http://www.tomshardware.com/forum/236614-50-most-linux-related-programming-language

Cgfx is a custom alias on drexel.edu's compile server so it won't work on your system.

Also their last example is using a custom graphics library developed at drexel.edu which is not available. You can't use the code in their example without the lib but you can use standard X11 calls instead.




http://linuxgazette.net/issue78/tougher.html

Code:
#include <X11/Xlib.h>
#include <unistd.h>

main()
{
  // Open a display.
  Display *d = XOpenDisplay(0);

  if ( d )
    {
      // Create the window
      Window w = XCreateWindow(d, DefaultRootWindow(d), 0, 0, 200,
			       100, 0, CopyFromParent, CopyFromParent,
			       CopyFromParent, 0, 0);

      // Show the window
      XMapWindow(d, w);
      XFlush(d);

      // Sleep long enough to see the window.
      sleep(10);
    }
  return 0;
}

You can compile the program with the following command:

prompt$ g++ test.cpp -L/usr/X11R6/lib -lX11
prompt$ ./a.out

Good luck :)