-
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

Vintage Link Terminal Mechanical Keyboard Alps Black Switches 840352-30
$139.95

Title:Rare Vintage Magnetic Core Memory Board Plane – Retro Computing Collectibl
$2000.00

Vintage eMate 300 Computer System Rare Kids Laptop Newton Operating System
$349.99

VINTAGE UMPC Fujitsu Lifebook P1120 8.9" Touchscreen Crusoe 800MHz - Windows XP
$349.95

Intel GRAMPA BURST 168-pin 486 CPU Interposer/Testing Adapter Board Vintage
$289.99

Vintage Apple Extended Keyboard II M3501 Mechanical ADB - Tested & Working
$54.99

Vintage Intel i860 A80860XP-40 SX582 RISC CPU Ceramic RARE SSpec Retro Computing
$178.46

Vintage Asus SP97-V Socket 7 Motherboard + Pentium 200 + 16mb + Video READ
$74.99

Apple Mac OS9 Cloth Banner Think Different 64 x 24 inches NEW ORIGINAL Vintage
$99.99

Vintage CB Micro Computer Intel Celeron 1.30Ghz w/ 256MB Ram, DVD, No HDD
$169.99