我正在使用Ubuntu18。我创建了一个静态库: /path-to-lib/myLib.a
我有一个要编译的项目,链接到该库。这是我要使用的makefile:
CC = g++
STANDARD_FLAGS = -std=c++11\
-pedantic-errors\
-Wall\
-Wextra\
-Werror\
-Wconversion\
-L/home/maxx/projects/Deck\
-llibStandardDeck
DEBUG_FLAGS = -g3
OPT_FLAGS = -O0
CCFLAGS = $(OPT_FLAGS) $(DEBUG_FLAGS) $(STANDARD_FLAGS)
LDFLAGS =
ROOT = $(CURDIR)
INCLUDES = -I$(ROOT)/src -I$(ROOT)/api
SRCS = ./src/obj0.cc\
./src/obj1.cc\
./src/obj2.cc\
./src/main.cc
OBJS = ./build/obj0.o\
./build/obj1.o\
./build/obj2.o\
./build/main.o
VPATH = src
BUILDDIR = build
LIBS =
MAIN = main
all: $(MAIN)
@echo $(MAIN) has been compiled!
$(MAIN): $(OBJS)
$(CC) $(CCFLAGS) $(OBJS) $(LDFLAGS) -o $(MAIN)
$(BUILDDIR)/%.o: %.cc
mkdir -p $(@D)
$(CC) $(CCFLAGS) $(INCLUDES) -c $< -o $@
depend: $(SRCS)
makedepend $(INCLUDES) $^
clean:
rm -r $(BUILDDIR) $(MAIN)
我得到了:
/usr/bin/ld: cannot find -lmyLib
不确定从这里尝试什么,也许我的makefile中有错误?