Prev: edge-triggered epoll, socket reading
Next: curses
From: Måns Rullgård on 25 Jun 2010 04:27 Vladimir Jovic <vladaspams(a)gmail.com> writes: > Scott Lurndal wrote: >> neil <invalid(a)invalid.net> writes: >>> Måns Rullgård <mans(a)mansr.com> wrote: >>>> neil <invalid(a)invalid.net> writes: >>>> >>>>> I have been trying to compile a program that uses Xlib.h. >>>>> >>>>> One of the source files has #include <X11/Xlib.h> >>>>> >>>>> I searched the system and found xlib.h is in >>>>> /usr/local/include/X11. Despite this, the compiler says xlib.h no >>>>> such file or directory. I >>>>> tried changing the #include to the full path name - but it just >>>>> leads to >>>>> errors further down the line. >>>>> >>>>> Can anyone see what I am doing wrong? Why does the compiler not >>>>> see xlib.h?? How can I fix this? >>>> -I/usr/local/include >>> Thank you I will make sure the path is in the linker setting of my IDE. >> that won't help. -I is for the compiler, not linker. >> for the linker, you'll need -L/usr/local/lib, before the -lX11. > > For every normal distro, you just need -lX11. No need for including > that path (for compiling or linking). > Or am I wrong? He's on BSD. Apparently that's not normal. -- M�ns Rullg�rd mans(a)mansr.com
From: Ersek, Laszlo on 25 Jun 2010 09:14 On Fri, 25 Jun 2010, M?ns Rullg?rd wrote: > Vladimir Jovic <vladaspams(a)gmail.com> writes: > >> Scott Lurndal wrote: >>> neil <invalid(a)invalid.net> writes: >>>> M??ns Rullg??rd <mans(a)mansr.com> wrote: >>>>> neil <invalid(a)invalid.net> writes: >>>>> >>>>>> I have been trying to compile a program that uses Xlib.h. >>>>>> >>>>>> One of the source files has #include <X11/Xlib.h> >>>>>> >>>>>> I searched the system and found xlib.h is in >>>>>> /usr/local/include/X11. Despite this, the compiler says xlib.h no >>>>>> such file or directory. I >>>>>> tried changing the #include to the full path name - but it just >>>>>> leads to >>>>>> errors further down the line. >>>>>> >>>>>> Can anyone see what I am doing wrong? Why does the compiler not >>>>>> see xlib.h?? How can I fix this? >>>>> -I/usr/local/include >>>> Thank you I will make sure the path is in the linker setting of my IDE. >>> that won't help. -I is for the compiler, not linker. >>> for the linker, you'll need -L/usr/local/lib, before the -lX11. >> >> For every normal distro, you just need -lX11. No need for including >> that path (for compiling or linking). >> Or am I wrong? > > He's on BSD. Apparently that's not normal. FWIW, at least with gcc, I like to set up C_INCLUDE_PATH, CPLUS_INCLUDE_PATH and LIBRARY_PATH correctly more than fiddling with -I and -L. If shared libraries are used and rpath's are not hardcoded, LD_LIBRARY_PATH is also useful to set. BTW, it seems to me perfectly reasonable to keep X out of the core system and install it under /usr/local via some ports mechanism. lacos
From: Chris Nehren on 27 Jun 2010 23:24 On 2010-06-25, Vladimir Jovic scribbled these curious markings: > For every normal distro, you just need -lX11. No need for including that > path (for compiling or linking). > Or am I wrong? The whole world is not an i386 Linux box configured just like the one you're typing on that has everything crammed into /usr/{include,lib}. You are, indeed, quite wrong. FreeBSD is not a 'distro' (for the sake of argument I'm going to ignore the fractured forks that don't really change anything except for adding some GUI tools), and 'normal' in terms of something so fractured and heterogeneous as Linux has no meaning whatsoever. The *correct* way to do this is with the following: headers: pkg-config --cflags x11 libraries: pkg-config --libs x11 The output of these invocations will be the correct flags to pass to the compiler and linker (on my system, compatible with both gcc and clang, but no guarantees for yours) and will work everywhere, regardless of whether one is living in i386 Linux fantasy land or the real world. -- Thanks and best regards, Chris Nehren Unless noted, all content I post is CC-BY-SA.
From: Alan Curry on 28 Jun 2010 01:29 In article <i094lv$9lk$1(a)news.eternal-september.org>, Chris Nehren <apeiron(a)isuckatdomains.net.invalid> wrote: >The *correct* way to do this is with the following: > >headers: pkg-config --cflags x11 >libraries: pkg-config --libs x11 Looking at this, I think of the time I spent learning imake(1). Why does my head hurt? -- Alan Curry
From: Måns Rullgård on 28 Jun 2010 05:56
pacman(a)kosh.dhis.org (Alan Curry) writes: > In article <i094lv$9lk$1(a)news.eternal-september.org>, > Chris Nehren <apeiron(a)isuckatdomains.net.invalid> wrote: >>The *correct* way to do this is with the following: >> >>headers: pkg-config --cflags x11 >>libraries: pkg-config --libs x11 > > Looking at this, I think of the time I spent learning imake(1). > > Why does my head hurt? At least imake works as intended, which is more than can be said about pkg-config. -- M�ns Rullg�rd mans(a)mansr.com |