Find the answer to your Linux question:
Results 1 to 5 of 5
WindowsDude is back! This time he has another delicate problem. He has recently compiled libgmp and now he wants to include it in his project. He writes like this: gcc ...
  1. #1
    Just Joined! WindowsDude's Avatar
    Join Date
    May 2010
    Location
    Wintopia
    Posts
    12

    Compile with library

    WindowsDude is back!

    This time he has another delicate problem.

    He has recently compiled libgmp and now he wants to include it in his project.

    He writes like this: gcc -lgmp project.c

    The problem is that -lgmp doesn't seem to load. What should he do to make it load?

    He has compiled libgmp in some local folder, but he wants it to be globally accessible. What are the magic key words for this? (Note: In -real- OSes made by real people this is never a problem. The DOS-days are over.).



    + Why are there dozens of unexplainable folders in the root directory? Why not just put all systems folders into one big Linux-folder and keep everything in order? I don't even know where to put programs that I install. Linux is doomed to stay in the world of permanent beta software!

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    You need to set your LD_LIBRARY_PATH environment variable to point to the location of the shared library if it hasn't been installed in one of the usual places (/usr/lib, /usr/lib64, etc).
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined! WindowsDude's Avatar
    Join Date
    May 2010
    Location
    Wintopia
    Posts
    12
    WindowsDude is back in the shady domains of nix and takes another look at this major problem.

    He does the following:
    LD_LIBRARY_PATH=/Users/windowsdude/Downloads/gmp-5.0.1

    gcc -L/Users/windowsdude/Downloads/gmp-5.0.1/ -lgmp /Users/windowsdude/Desktop/main.c


    But to his despair he gets errors where gmp variables aren't recognized. It probably doesn't find the library. gmp.h: No such file or directory (but it's inside that gmp folder).

    Why is that.


    On a side note: On the one and only real OS it is possible to use real tools like Visual Studio where compilation is made in one click, where paths are clear and where debugging can be done easily by breakpointing lines and checking their values inside the program. What's the linux equivalent?

  4. #4
    Linux Enthusiast gerard4143's Avatar
    Join Date
    Dec 2007
    Location
    Canada, Prince Edward Island
    Posts
    714
    Quote Originally Posted by WindowsDude View Post
    LD_LIBRARY_PATH=/Users/windowsdude/Downloads/gmp-5.0.1

    [/SIZE]
    Try

    LD_PRELOAD=/Users/windowsdude/Downloads/gmp-5.0.1 ./main
    Make mine Arch Linux

  5. #5
    Just Joined! WindowsDude's Avatar
    Join Date
    May 2010
    Location
    Wintopia
    Posts
    12
    The problem is when I try to compile (I don't have an executable).

    This line produces the error gmp.h: No such file or directory
    gcc -L/Users/windowsdude/Downloads/gmp-5.0.1/ -lgmp /Users/windowsdude/Desktop/main.c

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...