-
Junior Member
registered user
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);
}
}
-
Senior Member
registered user
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?
-
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
-
Junior Member
registered user
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
-
Forum Rules

USB 3.0 Flash Drive 32GB 64GB 128GB Memory Stick Thumb Stick Lot Pack
$826.09

MICRON MTA36ASF4G72PZ-2G6D1 32GB PC4-21300R DDR4-2666V RDIMM 2RX4 MEMORY DIMM
$139.99

Lot of 18 Mixed Brands PC4 32GB 2400T-R Server RAM
$2879.99

TF/SD Card Adapter Camera Reader Android Type-c For iPhone17 Pro Max Plusm lot
$573.98

Kingston 32GB 64GB 128GB 256GB USB 3.0 Flash Drive Thumb Memory Stick Pen lot
$285.90

SK Hynix 32GB PC4-2400T DDR4-2400 ECC RDIMM Server RAM HMA84GR7AFR4N-UH Tested
$235.00

Samsung 32GB DDR4-2666V-2Rx4-RB2-12 RAM M393A4K40CB2-CTD6Q
$169.00

USB 3.0 Micro SD SDHC TF Card Reader Memory Adapter for PC Laptop Camera lot
$3.75

1/ 10/ 100pcs USB 2.0 2GB, 4GB ,8GB ,16GB ,32GB ,64GB 128GB USB Flash Drives Lot
$202.50

Wholesale 5/10/100PCS 1GB 2GB 4GB 8GB 16GB 32GB USB 2.0 Flash Drive Memory Stick
$289.80