Dead Hackers Society
Other BBSes »
 
 
Demoscene  Coding  CT60  Buy/sell

Atari coding BBS
 
Re: LDFLAGS in Makefile
Posted by: mikro Apr,10.2008-13:35 

yes, it's simple but no, not _such_ simple ;)

simply, you have to know two things:

- where your library is (e.g. /usr/local/lib)
- what is its name (e.g. libsdlmixer.a)

now, you have to tell gcc this stuff. the path is often not an issue (gcc knows that libs can be found also in /usr/local/lib) but in some special cases you have to add it manually:

LDFLAGS=-L/usr/local/lib

(you can also add it to CFLAGS instead of LDFLAGS, if you prefer -- it has the same effect)

the tricky stuff comes with library name... linker wants its name in special form -- without "lib" prefix and without ".a" suffix... i.e. libsdlmixer.a becomes: sdlmixer, in our context:

LDFLAGS=-L/usr/local/lib -lsdlmixer

(please note that difference between -L and -l)

and... that's it ;) Math library (libm.a) is for example just "m" so if you use some math stuff, you add "-lm" to your gcc command line.

have fun! ;-)







[All messages in this thread]    [Start new thread]

Topic Posted by  Date 
LDFLAGS in Makefile MacFalcon Apr,10.2008-10:41
  Re: LDFLAGS in Makefile mikro Apr,10.2008-13:35
    Re: LDFLAGS in Makefile MacFalcon Apr,10.2008-16:21
      Re: LDFLAGS in Makefile mikro Apr,10.2008-17:29
        Re: LDFLAGS in Makefile MacFalcon Apr,10.2008-20:40


Reply to this message
Name:
Topic:
Anti-troll code:

Message:

What's the anti-troll code?
That's your personal code to be able to add comments and messages on the dhs.nu site.
Don't have a code or forgot it? Fix it here.
© 1994-2024 Dead Hackers Society Contact: Anders Eriksson