问题描述
Make说它没有什么可做的。我有互联网搜索,有几十种情况时,它说这个东西。没有解决方案帮助了...
我使用MinGW,在我的目录中有 Res.def
Res.h
, Res.cpp
和 Res.o
运行 g ++ -c Res.cpp
后得到的。
这是makefile:
CFLAGS = -c -G3 -GX -Od -W3 -Zi -D_X86_ = 1 -DWIN32 -D_WIN32 -nologo -DSTRICT
LFLAGS = -debug:mapped,full -debugtype:cv -nologo
LIBS = libc.lib kernel32.lib user32.lib
SRCS = Res.def Res.cpp Res.h
OBJS = Res.o
all:Res.dll
Res.dll:$(SRCS)$(OBJS)
(SRCS):
co $(SRCS)
.cpp.obj:
cl $(CFLAGS)$ *。cpp
.rc.rbj:
rc $ *。rc
cvtres -i386 $ *。res -o $ *。rbj
.obj.dll:
link $(LFLAGS)-DLL -subsystem:windows -out :$ *。dll \
-def:$ *。def $(OBJS)$(LIBS)
.obj.exe:
link $(LFLAGS)-subsystem:console -out :$ *。exe \
$ *。obj $(EXELIBS)
我做了dll?
UPDATE:
我可以有意义的C或C + +,我是一个总的noob在make文件,因此,我试图重新组装一个开源的DLL,在做一些更改的代码。我已经阅读关于构建C应用程序,但它没有什么帮助。原始make文件有 OBJS
行不同,它是
OBJS = Res.obj
当尝试以某种方式管理时,我已将它更改为 OBJS = Res.o
构建dll。所以原始文件是:
CFLAGS = -c -G3 -GX -Od -W3 -Zi -D_X86_ = 1 - DWIN32 -D_WIN32 -nologo -DSTRICT
LFLAGS = -debug:mapped,full -debugtype:cv -nologo
LIBS = libc.lib kernel32.lib user32.lib
SRCS = Res.def Res .cpp Res.h
OBJS = Res.obj
all:Res.dll
Res.dll:$(SRCS)$(OBJS)
$(SRCS):
co $(SRCS)
.cpp.obj:
cl $(CFLAGS)$ *。cpp
.rc.rbj:
rc $ *。rc
cvtres -i386 $ *。res -o $ *。rbj
.obj.dll:
link $ LFLAGS)-DLL -subsystem:windows -out:$ *。dll \
-def:$ *。def $(OBJS)$(LIBS)
.obj.exe:
link $(LFLAGS)-subsystem:console -out:$ *。exe \
$ *。obj $(EXELIBS)
$ b b
对于默认行,它是另一回事:
***没有规则目标`Res.obj`,需要`Res.dll`。停止。
请告诉我如何汇编这个简单的dll?我完全失去了。这些复杂性对于我来说,对于从单个源文件构建一个库这么简单的任务来说,这是一个过分的工具....
看起来您的目录中已经有最新的 $(OBJS)
,并且 all
。
链接通常涉及多个目标文件,因此更常见的是明确指定每个二进制文件的链接规则:
Res.dll:$(OBJS)Res.def
pre>
link ...
(注意Res.dll不直接依赖于.h和.cpp)。
但是,当然,您可以指定一个从.o文件中构建.dll文件的规则。我想这是你想要做的,但你的Makefile只有一个规则从 .obj 文件(不是 .o )构建一个.dll文件。 / p>
另一件事:
Res.o
文件应该依赖于Res.cpp和Res.h。所以你需要像这样的:Res.h:Res.h
.cpp.o:
g ++ -c $<
Make says it has nothing to do for all. I have searche the internet and there are dozens of situations when it says this thing. None of the solutions helped though...
I use MinGW, in my directory I have
Res.def
,Res.h
,Res.cpp
andRes.o
which I've got after runningg++ -c Res.cpp
.Here is the makefile:
CFLAGS = -c -G3 -GX -Od -W3 -Zi -D_X86_=1 -DWIN32 -D_WIN32 -nologo -DSTRICT LFLAGS = -debug:mapped,full -debugtype:cv -nologo LIBS = libc.lib kernel32.lib user32.lib SRCS = Res.def Res.cpp Res.h OBJS = Res.o all: Res.dll Res.dll: $(SRCS) $(OBJS) $(SRCS): co $(SRCS) .cpp.obj: cl $(CFLAGS) $*.cpp .rc.rbj: rc $*.rc cvtres -i386 $*.res -o $*.rbj .obj.dll: link $(LFLAGS) -DLL -subsystem:windows -out:$*.dll \ -def:$*.def $(OBJS) $(LIBS) .obj.exe: link $(LFLAGS) -subsystem:console -out:$*.exe \ $*.obj $(EXELIBS)
How do I make the dll?
UPDATE:
I come from Java and when i can make sense of C or C++, am a total noob at make files and hereby I am trying to re-assemble an open-source dll after doing some changes to the code. I have read about building C applications but it does not help much. The original make file had
OBJS
line different, it was
OBJS = Res.obj
I have changed it to
OBJS = Res.o
when trying to somehow manage to build the dll. So that the original file was:CFLAGS = -c -G3 -GX -Od -W3 -Zi -D_X86_=1 -DWIN32 -D_WIN32 -nologo -DSTRICT LFLAGS = -debug:mapped,full -debugtype:cv -nologo LIBS = libc.lib kernel32.lib user32.lib SRCS = Res.def Res.cpp Res.h OBJS = Res.obj all: Res.dll Res.dll: $(SRCS) $(OBJS) $(SRCS): co $(SRCS) .cpp.obj: cl $(CFLAGS) $*.cpp .rc.rbj: rc $*.rc cvtres -i386 $*.res -o $*.rbj .obj.dll: link $(LFLAGS) -DLL -subsystem:windows -out:$*.dll \ -def:$*.def $(OBJS) $(LIBS) .obj.exe: link $(LFLAGS) -subsystem:console -out:$*.exe \ $*.obj $(EXELIBS)
With that default line, it was saying another thing:
*** No rule to make target `Res.obj`, needed by `Res.dll`. Stop.
Please could you tell me how to assemble this simple dll? I am totally lost. These complexities seem to me an overkill for such a simple task of building a lib from a single source file....?
解决方案It looks like you already have up-to-date
$(OBJS)
in your directory, and there is really nothing to be done forall
.Linking usually concerns more than one object file, so it's more conventional to specify linking rules for each binary explicitly:
Res.dll: $(OBJS) Res.def link ...
(note that Res.dll doesn't depend on .h and .cpp directly).
But of course you can specify a rule for building a .dll file from an .o file instead. I guess this is what you are trying to do, but your Makefile only has a rule for building a .dll file from an .obj file (not .o).
One more thing: the
Res.o
file should depend on Res.cpp and Res.h. So you need something like:Res.o: Res.h .cpp.o: g++ -c $<
这篇关于没有什么可做的(另一个)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!