Library not found for -lfl

后端 未结 2 1898
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-13 10:04

I was using flex and bison to build a simple calculator project I cloned from Github.

But after I typed make in terminal, I go

相关标签:
2条回答
  • 2020-12-13 10:38

    warning: type specifier missing, defaults to 'int'

    mean that you should declare return type for main function. Place int in function difinition.

    ld: library not found for -lfl

    flag -l mean that compiller must use libfl.a to build programm. As @waTeim said above, for Mac OS you can use libl.a instead, but this lib can be not exist alse. There is another way is to place

    %option noyywrap
    

    at the top of flex *.l file. In this case you can compile without additional libs.

    0 讨论(0)
  • 2020-12-13 10:56

    let me guess, trying to use flex on OS/X?

    Try -ll instead of -lfl

    Using Flex on OS/X

    So yea, the flex library name on OS/X is just arbitrarily different for some reason. OS/X is not exactly Linux, but it's pretty close. You have some options here.

    1. You can just simply have a separate build system and source files for OS/X. Certainly Apple might like that with their pushing XCode, objective-C and not much interoperability.

    2. You can build vs Linux and then engage with Mac Ports and Homebrew.

    3. You can create your project using autotools. That's not an awesome link, learning this system is rough going, but it's a standard thing for Linux for sure. This will actually work, I find if you have the patience for it, OS/X is close enough that autotools based builds will work on it.

    4. Lately, I've been turned on to Cocoapods, which I believe to be an attempt to join the open source community and XCode. It's kind of half 1 and 3 sorta with an emphasis on modularizing the external source and getting it compiled into a .app (via Xcode).

    0 讨论(0)
提交回复
热议问题