-1

我有一个项目的下一个结构:

cruceGame/
    src/
        libCruceGame/...
        cruceGameCurses/...
        multiplayerCurses/...
        networking/...
        parser/...
    docs/...this doesn't matter...

该项目在 src/ 文件夹中有一个 Makefile.am:

AM_CPPFLAGS = -I$(top_srcdir)/src/libCruceGame -I$(top_srcdir)/src/networking -I$(top_srcdir)/src/cruceGameCurses -I$(top_srcdir)/src/multiplayerCurses
LDFLAGS = -no-undefined
CFLAGS += -std=c99

if DEBUG
CFLAGS += -g -Wall -DDEBUG
endif

lib_LTLIBRARIES = libCruceGame.la libNetworking.la libCruceGameCurses.la libMultiplayerCurses.la
bin_PROGRAMS = cruceGame

cruceGame_SOURCES = cruceGame.c

cruceGame_LDADD = libCruceGame.la libNetworking.la libCruceGameCurses.la libMultiplayerCurses.la
cruceGame_LDFLAGS = -lncursesw -lpthread

libCruceGame_la_SOURCES = libCruceGame/deck.c \
              libCruceGame/team.c \
              libCruceGame/round.c \
                          libCruceGame/game.c

libNetworking_la_SOURCES = networking/network.c

libCruceGameCurses_la_SOURCES = cruceGameCurses/main.c \
                                cruceGameCurses/cli.c

libMultiplayerCurses_la_SOURCES = multiplayerCurses/main.c \
                                  multiplayerCurses/cli.c \
                                  multiplayerCurses/ircHandlers.c

您可以在这里找到项目(查看开发分支):https ://github.com/danij/CruceGame 我正在尝试将 cruceGameCurses 和 multiplayerCurses 打包到库中,但它使用 libCruceGame。当我使用这个 makefile 时,我收到关于 libCruceGame 函数的未识别引用的错误。所以,我的问题是:如何将 libCruceGame 添加到 LDFLAGS?PS这个项目不是我写的,我只是贡献,我是图书馆的初学者。

4

1 回答 1

2

尝试更改此行:

cruceGame_LDFLAGS = -lncursesw -lpthread

对此:

cruceGame_LDFLAGS = -lncursesw -lpthread -L/directory/your/lib/is/in -lname

其中name是库文件名的中间部分。也就是说,如果文件是libfoo.alibfoo.so,则与选项一起使用的名称-l就是foo

于 2014-09-07T22:08:00.480 回答