小编kar*_*kkk的帖子

make: *** 没有规则可以创建目标“obj/main.o”。停止

我正在开发一个 SDL 项目,我使用 makefile 来构建它。我正在使用 MinGW w64 编译器和 make 在 Windows 上执行此操作。

我的项目结构看起来像这样

proj
------>bin        #stores the executable
------>include    #stroes the external library include files
------>lib        #stores the lib files of the libraries
------>obj        #stores the .o files
------>src        #source files
makefile

Run Code Online (Sandbox Code Playgroud)

我的 makefile 看起来像这样

CC = g++
OUT = main
ODIR = ./obj
SDIR = ./src 
OUTDIR = ./bin
IDIR = ./include 
LDIR = ./lib
libs = -lmingw32 -lSDL2main -lSDL2
OBJS = $(patsubst $(SDIR)/%.cpp,$(ODIR)/%.o,$(wildcard $(SDIR)/*.cpp))

$(ODIR)/%.o : $(SDIR)/%.cpp
    $(CC) …
Run Code Online (Sandbox Code Playgroud)

c++ makefile gnu-make

1
推荐指数
1
解决办法
2513
查看次数

标签 统计

c++ ×1

gnu-make ×1

makefile ×1