Thread: C-algorithms library from Sourceforge

  1. #1
    Registered User
    Join Date
    Feb 2013
    Location
    Buea Cameroon
    Posts
    64

    C-algorithms library from Sourceforge

    Hello Everyone i just downloaded and installed the c-algorithms package from here http://heanet.dl.sourceforge.net/sourceforge/c-algorithms/c-algorithms-1.2.0.tar.gz but i dont rely know how i can use it when compiling with gcc
    because when i use for example the <arraylist.h> header file and i compile with
    gcc -o main `pkg-config --cflags --libs libcalg1.0` main.c
    I get the error message
    Package libcalg1.0 was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libcalg1.0.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libcalg1.0' found
    main.c:2:22: fatal error: arraylist.h: No such file or directory
    #include<arraylist.h>
    ^
    compilation terminated.


    Any help on how to compile using this library. Thanks

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    How did you install the package?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Feb 2013
    Location
    Buea Cameroon
    Posts
    64
    Quote Originally Posted by laserlight View Post
    How did you install the package?
    by typing the following commands sequencially

    ./configure
    make
    make install

    I use linux and the gcc compiler to compile

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Well, maybe the package is named differently, e.g., libcalg1.2, but you're following documentation that was not updated to account for that.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Registered User
    Join Date
    May 2012
    Posts
    1,066
    Quote Originally Posted by acho.arnold View Post
    and i compile with
    gcc -o main `pkg-config --cflags --libs libcalg1.0` main.c
    I get the error message
    Package libcalg1.0 was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libcalg1.0.pc'

    The pkg-config file is called "libcalg
    -1.0.pc" (note the hyphen) in the source archive you've posted.

    Bye, Andreas

  6. #6
    Registered User
    Join Date
    Feb 2013
    Location
    Buea Cameroon
    Posts
    64
    Quote Originally Posted by AndiPersti View Post

    The pkg-config file is called "libcalg
    -1.0.pc" (note the hyphen) in the source archive you've posted.

    Bye, Andreas
    When i compile using

    gcc -o c `pkg-config --cflags --libs libcalg-1.0` main.c

    I still get the error message


    Package libcalg-1.0 was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libcalg-1.0.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libcalg-1.0' found
    main.c:2:22: fatal error: arraylist.h: No such file or directory
    #include<arraylist.h>
    ^
    compilation terminated.

  7. #7
    Registered User
    Join Date
    Feb 2013
    Location
    Buea Cameroon
    Posts
    64
    Quote Originally Posted by laserlight View Post
    Well, maybe the package is named differently, e.g., libcalg1.2, but you're following documentation that was not updated to account for that.
    Ive tried that but still no help....

  8. #8
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    Package libcalg-1.0 was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libcalg-1.0.pc'
    to the PKG_CONFIG_PATH environment variable
    O_o

    Have you done this?

    Soma

  9. #9
    Registered User
    Join Date
    Feb 2013
    Location
    Buea Cameroon
    Posts
    64
    Quote Originally Posted by phantomotap View Post
    O_o

    Have you done this?

    Soma
    I dont rely know how to do that can you help me?

  10. #10
    Registered User
    Join Date
    May 2012
    Posts
    1,066
    What's the output for the following commands:
    Code:
    echo $PKG_CONFIG_PATH
    find / -name "libcalg-1.0.pc" -print 2> /dev/null
    find /usr/local -name "*calg*" -print 2> /dev/null
    (Shouldn't that thread be moved to the Linux/Tech Board?)

    Bye, Andreas

  11. #11
    Registered User
    Join Date
    Feb 2013
    Location
    Buea Cameroon
    Posts
    64
    Quote Originally Posted by AndiPersti View Post
    What's the output for the following commands:
    Thanks i have done that and the code compiles correctly to the executable but i get the error message
    Code:
     error while loading shared libraries: libcalg.so.0: cannot open shared object file: No such file or directory
    Any help on this?

  12. #12
    Registered User
    Join Date
    Aug 2005
    Location
    Austria
    Posts
    1,990
    Did you run make install as root ?
    Kurt

  13. #13
    Registered User
    Join Date
    Feb 2013
    Location
    Buea Cameroon
    Posts
    64
    Quote Originally Posted by ZuK View Post
    Did you run make install as root ?
    Yes i Did install it as root

  14. #14

  15. #15
    Registered User
    Join Date
    Feb 2013
    Location
    Buea Cameroon
    Posts
    64
    The problem has been solve by adding the following lines to the file /etc/environment
    Code:
    	PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
    	LD_LIBRARY_PATH=/usr/local/lib
    The code can now be compiled with
    Code:
    gcc -o name_of_executable `pkg-config --cflags --libs libcalg-1.0` main.c
    Thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem linking a sourceforge project
    By eloy in forum C Programming
    Replies: 15
    Last Post: 05-03-2011, 07:15 PM
  2. Implementing Library Algorithms
    By jewelz in forum C++ Programming
    Replies: 9
    Last Post: 04-06-2009, 12:44 AM
  3. Sourceforge project
    By Scarvenger in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 08-15-2007, 06:23 PM
  4. Sourceforge
    By Lurker in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 08-25-2003, 11:53 AM
  5. Turtle CVS and sourceforge, no 'ls'
    By nickname_changed in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 08-05-2003, 03:19 AM