7

I'm trying to compile a program that there is -ll flag but gcc can't find. What is the l after -lreally a library or is this a typo? is hard find information about this on google.Such term is "vague".

Jack
  • 16,276
  • 55
  • 159
  • 284

2 Answers2

8

-ll means to link against Solaris's libl lex library (available in /usr/lib/libl.so).

(The -l option takes the name of the library, minus the lib prefix and the file extension.)

Frédéric Hamidi
  • 258,201
  • 41
  • 486
  • 479
  • Thanks very much. I can compile without this flag on linux. Can I have some problem in the final executable? – Jack Mar 31 '13 at 17:20
  • 4
    If you're on Linux, you are not using the AT&T `lex` but (most likely) `flex` instead. There is a library for `flex` — `libfl.a` or `libfl.so` or similar — and you'd link with it using `-lfl`. However, it provides a dummy `yywrap()` and a dummy `main()`, so you don't normally need it. The `lex` library provides more than that, such as support for `yyreject`, so it is necessary. – Jonathan Leffler Mar 31 '13 at 17:27
2

As in my case, flex by default didn't install libfl library (using Linux Mint)

So I had to install libfl-dev library separately

sudo apt install libfl-dev

and include a -lfl option instead of -ll in the commandline as in

gcc myfile.c -lfl -o myfile 
faruk13
  • 1,276
  • 1
  • 16
  • 23