LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > *BSD
User Name
Password
*BSD This forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.

Notices


Reply
  Search this Thread
Old 03-05-2011, 12:48 PM   #1
poehli
LQ Newbie
 
Registered: Mar 2011
Posts: 2

Rep: Reputation: 0
Exclamation X11 XOpenDisplay Problem


Hi Everyone!
I'm completeley new here and already got a problem ;D.
I just started to get into Xlib Programming and one the first function I called there was an issue:
When I try to run the XOpenDisplay function it either returns "undefined reference to 'XOpen Display'" without the -lX11 flag or it can't find -lX11
I checked if I got the necessary libery and stuff... I googled for hours, but all tips didn't help... Can anybody help me please?
Code:
#include<X11/Xlib.h>

int main()
{
  Display *dpy;

  if ((dpy = XOpenDisplay(NULL)) == NULL)
  {
    printf ("Error");
    return 1;
  }
}
This is kept really simple, I know, but it still doesn't work!
 
Old 03-05-2011, 02:47 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
You need to add something like this to your build command:
Quote:
"-l/usr/X11R6/include -L/usr/X11R6/lib"
<= substitute your actual Xlib header and library directories for "/usr/X11R6"
 
Old 03-05-2011, 03:43 PM   #3
poehli
LQ Newbie
 
Registered: Mar 2011
Posts: 2

Original Poster
Rep: Reputation: 0
Oh wow! Thanks, I just didn't do the lib but only the include filepath *duh*.
You are my hero - well almost
Thanks again
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
kdm: IO Error in XOpenDisplay erik_wout_ew2 Linux - Software 3 10-03-2010 07:09 AM
Combine SDL and XOpenDisplay windows. aatwell Programming 1 01-11-2008 02:29 PM
XOpenDisplay() fails JohnCain Programming 1 01-26-2005 10:42 PM
can't boot: IO Error in XOpenDisplay jeffreybluml Linux - Newbie 0 06-11-2004 06:41 AM
Headless, error on XOpendisplay chrismcnally Linux - General 0 03-20-2004 11:11 AM

LinuxQuestions.org > Forums > Other *NIX Forums > *BSD

All times are GMT -5. The time now is 12:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration