Results 1 to 4 of 4

Thread: Knoppix and X

Hybrid View

  1. #1
    Junior Member registered user
    Join Date
    Feb 2005
    Posts
    11

    Knoppix and X

    Hi.
    I have installed knoppix 3.7. Why can't i compile the following code? Do i have to install something so that it compiles correctly?


    Code:
    #include <stdio.h>
    #include <X11/Xlib.h>
    #include <X11/Xutil.h>
    
     
    int main()
    {        Display *display;
             Window root, win;
    	     int screen; 
             int x, y=100;
             unsigned int width=600, height=100;
             unsigned int bord=60;
             unsigned long bord_c=34;
             unsigned long back_c=232;
    	     char *display_name = NULL;
    	     
        if ( ( display=XOpenDisplay(display_name)) == NULL )
          { fprintf( stderr,"connexion au Xserver %s impossible\n",
                       XDisplayName(display_name));
            exit(-1); }
    	
        screen = DefaultScreen(display);
        root= RootWindow(display, screen);
        win = XCreateSimpleWindow(display,  root, 50, 50,
        				width, height, bord, bord_c, back_c);
        XMapWindow(display, win);
    
       while(1) {
            XEvent ev;
            XNextEvent(display, &ev);
            }
    }

  2. #2
    Senior Member registered user
    Join Date
    Feb 2003
    Posts
    929
    Dear God, it's a long time since I compiled C. What error messages does the compiler come up with? What commands are you issuing to the compiler?

  3. #3
    Member registered user
    Join Date
    Jan 2005
    Posts
    71
    It compiles fine using gcc -o x x.c -L/usr/X11R6/lib -lX11 - given you've called your file x.c; I have to admit that I use a Knoppix 3.7 HD installation, and doubtlessly have added a number of packages, probably also libx11-dev (that package contains the relevant header files) - to repeat fingers99: What error messages does the compiler come up with?

    Tom

  4. #4
    Junior Member registered user
    Join Date
    Feb 2005
    Posts
    11
    Thanks tom.

    Indeed, i forgot to compile with -lX11.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows XP, Vista, 8.1, Linux Knoppix, Office XP,  (6 CDS) picture

Windows XP, Vista, 8.1, Linux Knoppix, Office XP, (6 CDS)

$10.00



KNOPPIX 9.1 Linux Install & Live DVD 32bit & 64bit picture

KNOPPIX 9.1 Linux Install & Live DVD 32bit & 64bit

$19.99



KNOPPIX USB DVD OS , BEST OF ALL HIGHLY RECOMENDED picture

KNOPPIX USB DVD OS , BEST OF ALL HIGHLY RECOMENDED

$11.99



Knoppix Live GNU Linux System 9.1 on Bootable CD / DVD / USB Flash Drive picture

Knoppix Live GNU Linux System 9.1 on Bootable CD / DVD / USB Flash Drive

$5.99



Knoppix Linux Bootable OS v8.6

Knoppix Linux Bootable OS v8.6 "Original Live Operating System" 16G USB Stick

$20.85



Knoppix NSM 1.2 picture

Knoppix NSM 1.2

$8.00



VINTAGE SOFTWARE | KNOPPIX STD 0.1 (SECURITY TOOLS DISTRIBUTION) picture

VINTAGE SOFTWARE | KNOPPIX STD 0.1 (SECURITY TOOLS DISTRIBUTION)

$7.57



Knoppix Linux Bootable OS v8.6

Knoppix Linux Bootable OS v8.6 "Original Live Operating System" 32G USB Stick

$21.42



Hamshack Live DVD-ROM picture

Hamshack Live DVD-ROM

$7.00



Knoppix 5.0.1 ULTRA RARE Linux DVD - Linux Pro Extra August 2006 picture

Knoppix 5.0.1 ULTRA RARE Linux DVD - Linux Pro Extra August 2006

$33.98