Results 1 to 4 of 4

Thread: Knoppix and X

  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
  •  


Seagate ST6000NM0115 6TB 256MB 7200RPM 3.5

Seagate ST6000NM0115 6TB 256MB 7200RPM 3.5" SATA 6.0Gb/s Enterprise Hard Drive

$159.99



Seagate 14TB Exos X14 7200RPM SATA 6Gb/s 256MB 3.5

Seagate 14TB Exos X14 7200RPM SATA 6Gb/s 256MB 3.5" Enterprise HDD ST14000NM0408

$354.99



Seagate BarraCuda ST5000LM000 5TB 5400RPM SATA III 6Gb/s 2.5

Seagate BarraCuda ST5000LM000 5TB 5400RPM SATA III 6Gb/s 2.5" Internal Hard

$169.99



HUS726060ALA640 HGST Ultrastar  6TB SATA 6Gbps 7.2K 3.5

HUS726060ALA640 HGST Ultrastar 6TB SATA 6Gbps 7.2K 3.5" Hard Drive OF21860

$129.99



Western Digital WD Blue WD10EZEX 1 TB 3.5

Western Digital WD Blue WD10EZEX 1 TB 3.5" SATA III Desktop Hard Drive

$23.99



Toshiba DT01ACA100 1 TB 3.5

Toshiba DT01ACA100 1 TB 3.5" SATA III 3.5 in Desktop Hard Drive

$24.99



**77%-89% HEALTH**HGST Ultrastar 7K4000 HUS724040ALA640 4TB 7200 RPM 64MB Cache picture

**77%-89% HEALTH**HGST Ultrastar 7K4000 HUS724040ALA640 4TB 7200 RPM 64MB Cache

$69.99



Hitachi  / HGST Travelstar HTS541010B7E610 1TB 2.5

Hitachi / HGST Travelstar HTS541010B7E610 1TB 2.5" SATA III HDD

$29.99



HDD 3.5

HDD 3.5" SATA Hard Drive with Windows 10/Win 11 64x Installed Legacy

$35.00



HGST Ultrastar 2TB 3.5

HGST Ultrastar 2TB 3.5" Enterprise SATA 7200RPM Internal HDD HUS724020ALA640

$54.99