May 20, 2013
On 20 May 2013 16:29, Samms <matesax@gmail.com> wrote:
>
>
>
> "So that would be -L/path/to/Xlib -lXlib."
>
> gdc ./main.d -o Refuja -L/usr/include/X11/ -lXlib
>
> /usr/bin/ld: cannot find -lXlib
> collect2: ld returned 1 exit status
>

This only tells you that Xlib.so (or other name) does not exist on your system.


>
> And last:
>
> gdc ./main.d -o Refuja -L-L/usr/include/X11/ -L-lXlib /tmp/ccN5ul41.o: In function `_Dmain':
>

I've already said that gdc uses gcc switch syntax, not dmd.


> main.d:(.text+0x75): undefined reference to `_D3std1c5linux3X114Xlib17DefaultRootWindowFPS3std1c5linux3X114Xlib7DisplayZm'
> main.d:(.text+0xe6): undefined reference to `_D3std1c5linux3X114Xlib17DefaultRootWindowFPS3std1c5linux3X114Xlib7DisplayZm'
> main.d:(.text+0x163): undefined reference to `_D3std1c5linux3X114Xlib17DefaultRootWindowFPS3std1c5linux3X114Xlib7DisplayZm'

This tells you that you are not linking in the library for Xlib.d  are you instead supposed to compile X.d / Xlib.d with your application?


> main.d:(.text+0x3f): undefined reference to `XOpenDisplay'
> main.d:(.text+0x85): undefined reference to `XStringToKeysym'
> main.d:(.text+0x9c): undefined reference to `XKeysymToKeycode'
> main.d:(.text+0xd8): undefined reference to `XGrabKey'
> main.d:(.text+0x155): undefined reference to `XGrabButton'
> main.d:(.text+0x1d2): undefined reference to `XGrabButton'
> main.d:(.text+0x20a): undefined reference to `XNextEvent'
> main.d:(.text+0x24c): undefined reference to `XRaiseWindow'
> main.d:(.text+0x29d): undefined reference to `XGetWindowAttributes'
> main.d:(.text+0x3f2): undefined reference to `XMoveResizeWindow'
> collect2: ld returned 1 exit status
>

This tells you that you are not linking in the X11 library.


--
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';


On 20 May 2013 16:29, Samms <matesax@gmail.com> wrote:
> I not have installed Xlib.d - it is overwrite of Xlib.h for D language...
>
>
> "in your app you use lib A you still need link B"
>
> I'm not idiot...
>
>
> "Samms, do you have the correct xlib dev packages installed?"
>
> I'm not idiot...
>
>
> "So that would be -L/path/to/Xlib -lXlib."
>
> gdc ./main.d -o Refuja -L/usr/include/X11/ -lXlib
>
> /usr/bin/ld: cannot find -lXlib
> collect2: ld returned 1 exit status
>
> And last:
>
> gdc ./main.d -o Refuja -L-L/usr/include/X11/ -L-lXlib /tmp/ccN5ul41.o: In function `_Dmain':
>
> main.d:(.text+0x3f): undefined reference to `XOpenDisplay'
> main.d:(.text+0x75): undefined reference to
> `_D3std1c5linux3X114Xlib17DefaultRootWindowFPS3std1c5linux3X114Xlib7DisplayZm'
> main.d:(.text+0x85): undefined reference to `XStringToKeysym'
> main.d:(.text+0x9c): undefined reference to `XKeysymToKeycode'
> main.d:(.text+0xd8): undefined reference to `XGrabKey'
> main.d:(.text+0xe6): undefined reference to
> `_D3std1c5linux3X114Xlib17DefaultRootWindowFPS3std1c5linux3X114Xlib7DisplayZm'
> main.d:(.text+0x155): undefined reference to `XGrabButton'
> main.d:(.text+0x163): undefined reference to
> `_D3std1c5linux3X114Xlib17DefaultRootWindowFPS3std1c5linux3X114Xlib7DisplayZm'
> main.d:(.text+0x1d2): undefined reference to `XGrabButton'
> main.d:(.text+0x20a): undefined reference to `XNextEvent'
> main.d:(.text+0x24c): undefined reference to `XRaiseWindow'
> main.d:(.text+0x29d): undefined reference to `XGetWindowAttributes'
> main.d:(.text+0x3f2): undefined reference to `XMoveResizeWindow'
> collect2: ld returned 1 exit status
>
> "so, what exactly you are trying to do?"
>
> Title this post: "Compile X Window Manager"
>
> That I would want to create X Window Manager?



-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';
May 20, 2013
On 20 May 2013 17:00, Alexandr Druzhinin <drug2004@bk.ru> wrote:
> 20.05.2013 22:29, Samms пишет:
>
>> I not have installed Xlib.d - it is overwrite of Xlib.h for D language...
>>
>> "in your app you use lib A you still need link B"
>>
>> I'm not idiot...
>>
>> "Samms, do you have the correct xlib dev packages installed?"
>>
>> I'm not idiot...
>>
>> "So that would be -L/path/to/Xlib -lXlib."
>>
>> gdc ./main.d -o Refuja -L/usr/include/X11/ -lXlib
>> /usr/bin/ld: cannot find -lXlib
>> collect2: ld returned 1 exit status
>>
>> And last:
>>
>> gdc ./main.d -o Refuja -L-L/usr/include/X11/ -L-lXlib
>> /tmp/ccN5ul41.o: In function `_Dmain':
>> main.d:(.text+0x3f): undefined reference to `XOpenDisplay'
>> main.d:(.text+0x75): undefined reference to
>>
>> `_D3std1c5linux3X114Xlib17DefaultRootWindowFPS3std1c5linux3X114Xlib7DisplayZm'
>>
>> main.d:(.text+0x85): undefined reference to `XStringToKeysym'
>> main.d:(.text+0x9c): undefined reference to `XKeysymToKeycode'
>> main.d:(.text+0xd8): undefined reference to `XGrabKey'
>> main.d:(.text+0xe6): undefined reference to
>>
>> `_D3std1c5linux3X114Xlib17DefaultRootWindowFPS3std1c5linux3X114Xlib7DisplayZm'
>>
>> main.d:(.text+0x155): undefined reference to `XGrabButton'
>> main.d:(.text+0x163): undefined reference to
>>
>> `_D3std1c5linux3X114Xlib17DefaultRootWindowFPS3std1c5linux3X114Xlib7DisplayZm'
>>
>> main.d:(.text+0x1d2): undefined reference to `XGrabButton'
>> main.d:(.text+0x20a): undefined reference to `XNextEvent'
>> main.d:(.text+0x24c): undefined reference to `XRaiseWindow'
>> main.d:(.text+0x29d): undefined reference to `XGetWindowAttributes'
>> main.d:(.text+0x3f2): undefined reference to `XMoveResizeWindow'
>> collect2: ld returned 1 exit status
>>
>> "so, what exactly you are trying to do?"
>>
>> Title this post: "Compile X Window Manager"
>>
>> That I would want to create X Window Manager?
>
> You should build Xlib.d also and use correct path to library (your is wrong)
> like:
> gdc ./main.d path/to/Xlib.d -o Refuja -L-L/usr/lib/X11/ -L-lXlib
> /usr/include/Xlib point to headers, not to libraries it would be better to
> use something like above - I'm on windows now, can't say exactly.

Why are people so obsessed with -L-L and -L-l switches?

Oh wait... dmd...

--
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';
May 20, 2013
On 20 May 2013 16:29, Samms <matesax@gmail.com> wrote:
> I not have installed Xlib.d - it is overwrite of Xlib.h for D language...
>
>
> "in your app you use lib A you still need link B"
>
> I'm not idiot...
>
>
> "Samms, do you have the correct xlib dev packages installed?"
>
> I'm not idiot...
>

I've RTFM.

http://www.dsource.org/projects/bindings/browser/trunk/X11/README

---
How I use Xlib binding ?
--------------------------


- add "import std.c.linux.Xlib;" to your code.
- use Xlib functions like in C with some minor change:
this bindings is more strongly typed than C version,it use D features
when it can.

so instead of writing:
    GC gc=XCreateGC(display,window,GCForeground | GCBackground,&values);
you while need to write:
    GC gc=XCreateGC(display,window,GCMask.GCForeground |
GCMask.GCBackground,&values);

For example you will compile your code like this if you're using dmd:
    dmd yourfile.d Xlib.d X.d  -L-lX11 (don't forget -L-lX11 ;) )

For a complete example read example.d
---

So... s/dmd/gdc and you get:

gdc yourfile.d Xlib.d X.d -lX11



--
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';
May 20, 2013
It resolved only small part of errors:

gdc ./main.d /usr/include/d2/4.6/std/c/linux/X11/Xlib.d -o Refuja -L-L/usr/include/X11/ -L-lXlib
/tmp/ccFcEKHG.o: In function `_Dmain':
main.d:(.text+0x3f): undefined reference to `XOpenDisplay'
main.d:(.text+0x85): undefined reference to `XStringToKeysym'
main.d:(.text+0x9c): undefined reference to `XKeysymToKeycode'
main.d:(.text+0xd8): undefined reference to `XGrabKey'
main.d:(.text+0x155): undefined reference to `XGrabButton'
main.d:(.text+0x1d2): undefined reference to `XGrabButton'
main.d:(.text+0x20a): undefined reference to `XNextEvent'
main.d:(.text+0x24c): undefined reference to `XRaiseWindow'
main.d:(.text+0x29d): undefined reference to `XGetWindowAttributes'
main.d:(.text+0x3f2): undefined reference to `XMoveResizeWindow'
collect2: ld returned 1 exit status
May 21, 2013
On Monday, 20 May 2013 at 16:28:09 UTC, Samms wrote:
> It resolved only small part of errors:
>
> gdc ./main.d /usr/include/d2/4.6/std/c/linux/X11/Xlib.d -o Refuja -L-L/usr/include/X11/ -L-lXlib
> /tmp/ccFcEKHG.o: In function `_Dmain':
> main.d:(.text+0x3f): undefined reference to `XOpenDisplay'
> main.d:(.text+0x85): undefined reference to `XStringToKeysym'
> main.d:(.text+0x9c): undefined reference to `XKeysymToKeycode'
> main.d:(.text+0xd8): undefined reference to `XGrabKey'
> main.d:(.text+0x155): undefined reference to `XGrabButton'
> main.d:(.text+0x1d2): undefined reference to `XGrabButton'
> main.d:(.text+0x20a): undefined reference to `XNextEvent'
> main.d:(.text+0x24c): undefined reference to `XRaiseWindow'
> main.d:(.text+0x29d): undefined reference to `XGetWindowAttributes'
> main.d:(.text+0x3f2): undefined reference to `XMoveResizeWindow'
> collect2: ld returned 1 exit status

as Iain said above now you need to link x11 also
May 21, 2013
Hooray! :)

gdc ./main.d /usr/include/d2/4.6/std/c/linux/X11/Xlib.d -o Refuja -L-L/usr/include/X11/ -L-lXlib -lX11
May 21, 2013
On 21 May 2013 04:58, Samms <matesax@gmail.com> wrote:
> Hooray! :)
>
> gdc ./main.d /usr/include/d2/4.6/std/c/linux/X11/Xlib.d -o Refuja -L-L/usr/include/X11/ -L-lXlib -lX11

Though why on earth are you still using -L-L and -L-l ?


-Ldir
           Add directory dir to the list of directories to be searched for -l.


All you are doing is adding '-L/usr/include/X11/' and '-lXlib' as search directories (hint: they very likely don't exist).


Regards
--
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';
May 21, 2013
On Tuesday, 21 May 2013 at 06:59:55 UTC, Iain Buclaw wrote:
> On 21 May 2013 04:58, Samms <matesax@gmail.com> wrote:

Basically, the command line should be:

gdc ./main.d /usr/include/d2/4.6/std/c/linux/X11/Xlib.d -o Refuja
-L/usr/include/X11/ -lXlib -lX11

with the "-L/usr/include/X11/" part being almost useless (more probably, you wanted to write: "-L/usr/lib", but that should be taken into account by default.

Samms, try this:

gdc ./main.d /usr/include/d2/4.6/std/c/linux/X11/Xlib.d -o Refuja -lXlib -lX11
May 21, 2013
On Tuesday, 21 May 2013 at 08:35:09 UTC, eles wrote:
> On Tuesday, 21 May 2013 at 06:59:55 UTC, Iain Buclaw wrote:
>> On 21 May 2013 04:58, Samms <matesax@gmail.com> wrote:
>
> Basically, the command line should be:
>
> gdc ./main.d /usr/include/d2/4.6/std/c/linux/X11/Xlib.d -o Refuja
> -L/usr/include/X11/ -lXlib -lX11
>
> with the "-L/usr/include/X11/" part being almost useless (more probably, you wanted to write: "-L/usr/lib", but that should be taken into account by default.
>
> Samms, try this:
>
> gdc ./main.d /usr/include/d2/4.6/std/c/linux/X11/Xlib.d -o Refuja -lXlib -lX11

This problem is resolved...

>Hooray! :)

>gdc ./main.d /usr/include/d2/4.6/std/c/linux/X11/Xlib.d -o Refuja -L-L/usr/include/X11/ -L-lXlib -lX11
May 21, 2013
On Tuesday, 21 May 2013 at 12:36:27 UTC, Samms wrote:
> On Tuesday, 21 May 2013 at 08:35:09 UTC, eles wrote:
>> On Tuesday, 21 May 2013 at 06:59:55 UTC, Iain Buclaw wrote:
>>> On 21 May 2013 04:58, Samms <matesax@gmail.com> wrote:
>>
> This problem is resolved...

I know. I was offering a simpler solution (command line), that's all.