Thread: CMake issue with Cairo

  1. #1
    Registered User
    Join Date
    Nov 2021
    Posts
    3

    CMake issue with Cairo

    Hi guys!


    CMake issue with Cairo or libX11


    Hi guys!


    I am new here and intend to frequent these forums both to answer questions and look for help when needed.


    Right now I am teaching myself CMake along with C and C Sharp. I have already been using C++ for a while.


    Right now though, I am having an issue with CMake and Cairo Graphics Library and libX11. I have a program I started, when I build I get this message:


    Undefined reference to symbol ‘XOpenDisplay’




    This is the line of code that generates that error:
    Display* d = XOpenDisplay(NULL);


    I update CMake with:
    cmake -S . -B build/


    When I do this it consistently tells me that it is successfully finding the libraries for cairo and libX11, those being:


    libXext.so and libXext.so


    This leads me to believe that there is something I need to do with my CMakeLists.txt that I am not seeing. I have looked all over, researched to death and am at a loss, so now I am posting for help. I am attaching my CMakeLists.txt


    I am using Arch Linux, my IDE is KDevelop. Thank you in advance.






  2. #2
    Registered User
    Join Date
    Nov 2021
    Posts
    3
    Quote Originally Posted by sheaisidore View Post
    Hi guys!


    CMake issue with Cairo or libX11
    ?

    Hi guys!


    I am new here and intend to frequent these forums both to answer questions and look for help when needed.


    Right now I am teaching myself CMake along with C and C Sharp. I have already been using C++ for a while.


    Right now though, I am having an issue with CMake and Cairo Graphics Library and libX11. I have a program I started, when I build I get this message:


    Undefined reference to symbol ‘XOpenDisplay’




    This is the line of code that generates that error:
    Display* d = XOpenDisplay(NULL);


    I update CMake with:
    cmake -S . -B build/


    When I do this it consistently tells me that it is successfully finding the libraries for cairo and libX11, those being:


    libXext.so and libXext.so


    This leads me to
    Quote Originally Posted by sheaisidore View Post
    toilet overflowing michigan believe that there is something I need to do with my CMakeLists.txt that I am not seeing. I have looked all over, researched to death and am at a loss, so now I am posting for help. I am attaching my CMakeLists.txt


    I am using Arch Linux, my IDE is KDevelop. Thank you in advance.






    no feedback ?

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Are you linking with the right libraries.

    Code:
    $ nm -D --defined-only /usr/lib/x86_64-linux-gnu/libX11.so.6 | grep XOpenDisplay
    000000000002e2f0 T XOpenDisplay
    $
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. CMake issue with Cairo or libX11
    By jawoods141 in forum C Programming
    Replies: 5
    Last Post: 10-16-2021, 01:27 PM
  2. CMake Help (losing my mind :(()
    By scorp08 in forum C++ Programming
    Replies: 3
    Last Post: 09-28-2019, 10:20 AM
  3. CMake help?
    By Chris87 in forum C Programming
    Replies: 1
    Last Post: 04-06-2019, 06:21 PM
  4. Cannot generate cmake for pcre in c
    By diego31416 in forum C Programming
    Replies: 1
    Last Post: 10-28-2018, 11:56 PM
  5. cairo-dock issue
    By Annonymous in forum Linux Programming
    Replies: 2
    Last Post: 06-03-2012, 12:14 AM

Tags for this Thread