Hello World: Error

walter harms wharms at bfs.de
Wed May 2 01:12:40 PDT 2012



Am 02.05.2012 00:53, schrieb Jerrold Clint Balansi:
> Thanks for your reply..
> 
> Here's what I got
> 
> [root at vizwall jcX Files]# ldd ./HelloX
>         libX11.so.6 => /usr/lib64/libX11.so.6 (0x00000033efe00000)
>         libc.so.6 => /lib64/libc.so.6 (0x00000033eda00000)
>         libXau.so.6 => /usr/lib64/libXau.so.6 (0x00000033f0600000)
>         libXdmcp.so.6 => /usr/lib64/libXdmcp.so.6 (0x00000033f0200000)
>         libdl.so.2 => /lib64/libdl.so.2 (0x00000033ee200000)
>         /lib64/ld-linux-x86-64.so.2 (0x00000033ed600000)
> [root at vizwall jcX Files]#
> 
This is good, we are not missing something obvious.


> 
> As non-root user.. this is the output.
> 
> bash-3.2$ ./HelloX
> Xlib: connection to ":0.0" refused by server
> Xlib: No protocol specified
> 

That means that you do not have the right to access the server.
Normally this happens when people do "su" to change the user
and start a X11 Programm.

Can you login as normal User and start this hellox in an xterm ?

A running xterm will show that your xserver works as expected and
the hellox should work.

re,
 wh

> ./HelloX: couldn't connect to X server (null)
> bash-3.2$
> bash-3.2$ ldd ./HelloX
>         libX11.so.6 => /usr/lib64/libX11.so.6 (0x00000033efe00000)
>         libc.so.6 => /lib64/libc.so.6 (0x00000033eda00000)
>         libXau.so.6 => /usr/lib64/libXau.so.6 (0x00000033f0600000)
>         libXdmcp.so.6 => /usr/lib64/libXdmcp.so.6 (0x00000033f0200000)
>         libdl.so.2 => /lib64/libdl.so.2 (0x00000033ee200000)
>         /lib64/ld-linux-x86-64.so.2 (0x00000033ed600000)
> bash-3.2$
> 
> -jerrold
> 
> On Tue, May 1, 2012 at 1:23 AM, walter harms <wharms at bfs.de> wrote:
> 
>>
>>
>> Am 30.04.2012 22:15, schrieb Jerrold Clint Balansi:
>>> Hi wh,
>>>
>>> I did your instruction and it compiled. Here's what I got.
>>>
>>> [root at vizwall jcX Files]# make
>>> cc -Wall    HelloX.c -lX11  -o HelloX
>>> [root at vizwall jcX Files]# ./HelloX
>>> X connection to :0.0 broken (explicit kill or server shutdown).
>>> [root at vizwall jcX Files]#
>>>
>>
>> to be fair, i am confused.
>>
>> 1. root at vizwall -> indicates that you are running as root
>>   you should try things always as USER
>>
>> 2. "X connection to :0.0 broken" should appear when the connection
>>   to the server (== your display) is gone. this happens when you
>>   have a remote login (do you ?) but :0.0 shows that is the local
>>   box and from the other mail i see that xclock is working ....
>>
>> wild guess ...
>> could you please check with "ldd ./hellox" is there something missing ?
>>
>> my output looks like these:
>>  ldd ./hellox
>>        linux-vdso.so.1 =>  (0x00007fffff1ff000)
>>        libX11.so.6 => /usr/lib64/libX11.so.6 (0x00007f01e385e000)
>>        libc.so.6 => /lib64/libc.so.6 (0x00007f01e3505000)
>>        libxcb-xlib.so.0 => /usr/lib64/libxcb-xlib.so.0 (0x00007f01e3303000)
>>        libxcb.so.1 => /usr/lib64/libxcb.so.1 (0x00007f01e30e7000)
>>        libXau.so.6 => /usr/lib64/libXau.so.6 (0x00007f01e2ee3000)
>>        libdl.so.2 => /lib64/libdl.so.2 (0x00007f01e2cdf000)
>>        /lib64/ld-linux-x86-64.so.2 (0x00007f01e3b9b000)
>>
>> re,
>>  wh
>>
>>> Is there anyting I should know why I'm getting this X connection to :0.0
>>> broken (explicit kill or server .. Thank you.
>>>
>>>
>>> -jerrold
>>>
>>>
>>> On Fri, Apr 27, 2012 at 5:28 AM, walter harms <wharms at bfs.de> wrote:
>>>
>>>>
>>>>
>>>> Am 24.04.2012 11:51, schrieb Michal Hejduk:
>>>>> On Monday 23 of April 2012 14:13:28 Jerrold Clint Balansi wrote:
>>>>>
>>>>> Hi Julien,
>>>>> I'm sorry that I'm pretty much new in to this Xlib programming, how
>>>> exactly
>>>>> can I do that?
>>>>>
>>>>> Thank you for your help.
>>>>>
>>>>> -jerrold
>>>>>
>>>> hi jerrold,
>>>> please save the 3 lines below in a file called "makefile", then start
>> make.
>>>> Give you have all needed libes it should work the example complies for
>> me
>>>> without problems.
>>>>
>>>> re,
>>>>  wh
>>>>
>>>> LOADLIBES=-lX11
>>>> CFLAGS=-Wall
>>>> hellox:
>>>>
>>>>
>>>>>
>>>>> On Mon, Apr 23, 2012 at 2:10 PM, Julien Cristau <jcristau at debian.org>
>>>> wrote:
>>>>>
>>>>> On Mon, Apr 23, 2012 at 13:55:34 -0700, Jerrold Clint Balansi wrote:
>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> I am trying to make a Hello World program from code from this site:
>>>>>> http://www.paulgriffiths.net/program/c/srcs/helloxsrc.html
>>>>>>
>>>>>> However, when I try to compile and run it I get this error. Can some
>>>> give
>>>>>> me a hint. Thank you.
>>>>>>
>>>>>> [root at vizwall Desktop]# gcc -o HelloX HelloX.c
>>>>>>> /tmp/ccMGGmGj.o: In function `main':
>>>>>>> HelloX.c:(.text+0x42): undefined reference to `XAllocSizeHints'
>>>>>
>>>>>
>>>>> You need to link with -lX11.
>>>>>
>>>>> Cheers,
>>>>> Julien
>>>>>
>>>>>
>>>>> Compile with:
>>>>>
>>>>> gcc -lX11 -o HelloX HelloX.c
>>>>>
>>>>> Nazdar
>>>>> Michal
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> xorg at lists.x.org: X.Org support
>>>>> Archives: http://lists.freedesktop.org/archives/xorg
>>>>> Info: http://lists.x.org/mailman/listinfo/xorg
>>>>> Your subscription address: wharms at bfs.de
>>>> _______________________________________________
>>>> xorg at lists.x.org: X.Org support
>>>> Archives: http://lists.freedesktop.org/archives/xorg
>>>> Info: http://lists.x.org/mailman/listinfo/xorg
>>>> Your subscription address: jcx4ever at gmail.com
>>>>
>>>
>>
> 



More information about the xorg mailing list