C ld.exe找不到-lfl

C ld.exe找不到-lfl,c,mingw,shakespeare-lang,C,Mingw,Shakespeare Lang,我正在使用mingw编译莎士比亚编程语言,在编译过程中,我得到了以下错误 c:/users/neil/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -lfl collect2: ld returned 1 exit status mingw32-make: *** [spl2c] Error 1 我在谷歌上搜索了一下,发现一些人在ld.exe上有问题,但大多数人在其他标志上有问题,找

我正在使用mingw编译莎士比亚编程语言,在编译过程中,我得到了以下错误

c:/users/neil/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe:
cannot find -lfl
collect2: ld returned 1 exit status
mingw32-make: *** [spl2c] Error 1
我在谷歌上搜索了一下,发现一些人在ld.exe上有问题,但大多数人在其他标志上有问题,找不到任何有用的东西。
-lfl
标志的作用是什么,如何解决此问题? 编辑:我已经从下载了flex二进制文件,并将它们添加到我的路径中

这是我的
Makefile

########################################################################
#
# SPL, the Shakespeare Programming Language
#
# Copyright (C) 2001 Karl Hasselström and Jon Åslund
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# USA.
#
########################################################################

NAME     = spl
VERSION  = 1.2.1
DISTNAME = $(NAME)-$(VERSION)

# compiler commands 
AR      = ar
CC      = gcc
LEX     = flex
RANLIB  = ranlib
TAR     = tar
YACC    = bison

INCLUDEPATH = include
EDITORPATH  = editor
EXAMPLEPATH = examples

# source / outputs
MAKESCANNERINCLUDE = $(wildcard $(INCLUDEPATH)/*.{wordlist,metaflex})

# compiler flags
YACCFLAGS = --verbose
CCFLAGS   = -O2 -Wall -LC:/Users/Neil/Downloads/Exes/flex-2.5.4a-1-bin
LEXFLAGS  = -Cem

.PHONY: all clean examples install libspl tar
all: install examples

examples: install
    $(MAKE) -C $(EXAMPLEPATH) all

grammar.tab.h grammar.tab.c: grammar.y
    $(YACC) $(YACCFLAGS) -d $<

grammar.tab.o: grammar.tab.c grammar.tab.h telma.h
    $(CC) $(CCFLAGS) -c $<

install: spl2c libspl.a spl.h
    mkdir -p spl/bin spl/include spl/lib
    cp -pf spl2c spl/bin
    cp -pf spl.h spl/include
    cp -pf libspl.a spl/lib

libspl.a: libspl.o strutils.o
    $(AR) rc $@ $^
    $(RANLIB) $@

libspl.o: libspl.c spl.h
    $(CC) $(CCFLAGS) -c $<

makescanner: makescanner.o
    $(CC) $< $(CCFLAGS) -o $@

makescanner.o: makescanner.c
    $(CC) $(CCFLAGS) -c $<

scanner.c: scanner.l
    $(LEX) $(LEXFLAGS) -t $< > $@

scanner.l: makescanner $(MAKESCANNERINCLUDE)
    $< $(INCLUDEPATH) > $@ #remove ./

scanner.o: scanner.c grammar.tab.h telma.h
    $(CC) $(CCFLAGS) -c $<

spl2c: grammar.tab.o scanner.o strutils.o
    $(CC) $^ $(CCFLAGS) -lfl -o $@

strutils.o: strutils.c strutils.h
    $(CC) $(CCFLAGS) -c $<

tar: clean
    mkdir -p $(DISTNAME)
    cp `find . -type f -maxdepth 1` $(DISTNAME)
    cp -r $(INCLUDEPATH) $(DISTNAME)
    cp -r $(EDITORPATH) $(DISTNAME)
    cp -r $(EXAMPLEPATH) $(DISTNAME)
    $(TAR) zcvf $(DISTNAME).tar.gz $(DISTNAME)

# clean-up function
clean:
    rm -f *~ $(EDITORPATH)/*~ $(INCLUDEPATH)/*~ *.l *.o *.a core grammar.output grammar.tab.h grammar.tab.c scanner.c makescanner spl2c *.tar.gz
    rm -rf spl $(DISTNAME)
    $(MAKE) -C $(EXAMPLEPATH) clean
########################################################################
#
#莎士比亚编程语言SPL
#
#版权所有(C)2001 Karl Hasselström和JonÅslund
#
#这个程序是自由软件;您可以重新分发和/或修改它
#它是根据GNU通用公共许可证的条款发布的
自由软件基金会;许可证的第2版,或(位于
#您的选择)任何更高版本。
#
#这个程序的发布是希望它会有用,但是
#无任何保证;甚至没有任何关于
#适销性或适合某一特定目的。见GNU
#有关详细信息,请参阅通用公共许可证。
#
#您应该已经收到GNU通用公共许可证的副本
#与此同时,;如果没有,请写信给自由软件
基金会,59寺庙广场套房330,波士顿,MA 02111-1307,
#美国。
#
########################################################################
名称=spl
版本=1.2.1
DISTNAME=$(名称)-$(版本)
#编译器命令
AR=AR
CC=gcc
LEX=flex
RANLIB=RANLIB
焦油=焦油
野牛
INCLUDEPATH=include
EDITORPATH=editor
EXAMPLEPATH=示例
#来源/产出
MAKESCANNERINCLUDE=$(通配符$(INCLUDEPATH)/*。{wordlist,metaflex})
#编译器标志
YACCFLAGS=--verbose
CCFLAGS=-O2-Wall-LC:/Users/Neil/Downloads/Exes/flex-2.5.4a-1-bin
LEXFLAGS=-Cem
.虚假:所有干净的示例都安装libspl tar
全部:安装示例
示例:安装
$(MAKE)-C$(示例路径)全部
语法.tab.h语法.tab.c:语法.y
$(YACC)$(YACCFLAGS)-d$<
grammar.tab.o:grammar.tab.c grammar.tab.h telma.h
$(CC)$(CCFLAGS)-c$<
安装:spl2c libspl.a spl.h
mkdir-p spl/bin spl/include spl/lib
cp-pf spl2c spl/bin
cp-pf spl.h spl/包括
cp-pf libspl.a spl/lib
libspl.a:libspl.o strutils.o
$(AR)rc$@$^
$(RANLIB)$@
libspl.o:libspl.cspl.h
$(CC)$(CCFLAGS)-c$<
makescanner:makescanner.o
$(CC)$<$(CCFLAGS)-o$@
o:makescanner.c
$(CC)$(CCFLAGS)-c$<
scanner.c:scanner.l
$(LEX)$(LEXFLAGS)-t$<>$@
scanner.l:makescanner$(MAKESCANNERINCLUDE)
$<$(INCLUDEPATH)>$@#删除/
scanner.o:scanner.c grammar.tab.h telma.h
$(CC)$(CCFLAGS)-c$<
spl2c:grammar.tab.o scanner.o strutils.o
$(CC)$^$(CCFLAGS)-lfl-o$@
strutils.o:strutils.c strutils.h
$(CC)$(CCFLAGS)-c$<
焦油:干净
mkdir-p$(DISTNAME)
cp`查找-类型f-maxdepth 1`$(DISTNAME)
cp-r$(INCLUDEPATH)$(DISTNAME)
cp-r$(编辑路径)$(DISTNAME)
cp-r$(示例路径)$(DISTNAME)
$(TAR)zcvf$(DISTNAME).TAR.gz$(DISTNAME)
#清理功能
清洁:
rm-f*~$(EDITORPATH)/*~$(INCLUDEPATH)/*~*.l*.o*.a core grammar.output grammar.tab.h grammar.tab.c scanner.c makescanner spl2c*.tar.gz
rm-rf spl$(DISTNAME)
$(使)-C$(示例路径)干净

flex
添加到
路径
不会使flex库可用于链接器
ld.exe
。您可能需要将flex库目录添加到。

尝试-LC:\pathtoflexlibdirectory
其中
libfl。一个
文件是
libfl
是flex的共享库。Flex是一个解析器<代码>-lfl
表示“链接到
fl
库”。您是否安装了flex?您可能有一个名为
flex
的包丢失或安装不正确。我从下载了flex二进制文件并将其添加到路径中。它会是ld-L吗?您的
Makefile
看起来像什么?很有可能,您可以将
-L/path/to/flex/directory
添加到
CFLAGS
变量中。添加到flex目录或flex目录的bin目录中?这是更新的makefile。它不起作用,广告给了我同样的错误。