Can't find library although I specify where it should look

This is a discussion on Can't find library although I specify where it should look within the Linux Programming forums, part of the Platform Specific Boards category; I'm trying to get sdl to work. I figured that I most likly didn't have to install it again since ...

  1. #1
    Wannabe Coding God
    Join Date
    Mar 2003
    Posts
    259

    Can't find library although I specify where it should look

    I'm trying to get sdl to work. I figured that I most likly didn't have to install it again since I already have it installed for fink and a library should be a library...

    So I decided to try to link it to the lib I already have using:

    Code:
    gcc -L/sw/lib/ -llibSDL  -llibSDLmain -I /sw/include -framework Cocoa example1.c
    but I get

    Code:
    ld: can't locate file for: -llibSDL
    although I know that the files are in sw/lib...I tried searching google and the sdl website to find out what's wrong but I haven't found anything
    They say that if you play a Windows Install CD backwords, you hear satanic messages. That's nothing; play it forward and it installs Windows.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,417
    Libraries are searched in the order listed on the command line, at the point in the command line they're present.

    So
    Code:
    gcc -L/sw/lib/ -I/sw/include -framework Cocoa example1.c -llibSDL  -llibSDLmain

  3. #3
    Wannabe Coding God
    Join Date
    Mar 2003
    Posts
    259
    I tried this, but I still get the same message.
    They say that if you play a Windows Install CD backwords, you hear satanic messages. That's nothing; play it forward and it installs Windows.

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,417
    Ah, you have the wrong name then

    To search a library called libfoo.a
    You write -lfoo
    Drop the lib prefix AND .a suffix

    Code:
    gcc -L/sw/lib/ -I/sw/include -framework Cocoa example1.c -lSDL  -lSDLmain

  5. #5
    Wannabe Coding God
    Join Date
    Mar 2003
    Posts
    259
    ah, it worked, thx a ton
    They say that if you play a Windows Install CD backwords, you hear satanic messages. That's nothing; play it forward and it installs Windows.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Makefile for a library
    By sirmoreno in forum Linux Programming
    Replies: 5
    Last Post: 06-04-2006, 04:52 AM
  2. Replies: 19
    Last Post: 01-12-2006, 10:04 AM
  3. very weird .h problem
    By royuco77 in forum C++ Programming
    Replies: 1
    Last Post: 09-11-2005, 07:55 AM
  4. Problem With WinPcap library
    By DrMario in forum C Programming
    Replies: 0
    Last Post: 03-26-2005, 10:26 AM
  5. Won't Return pointer, i can't find why...
    By ss3x in forum C++ Programming
    Replies: 2
    Last Post: 02-28-2002, 07:50 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21