gpt4 book ai didi

c++ - 为什么我的 Makefile 没有创建可执行文件?

转载 作者:行者123 更新时间:2023-11-28 03:23:26 25 4
gpt4 key购买 nike

老实说,我对以下代码的理解相当有限。但是,据我所知,它应该创建某种可执行文件,以便我可以“测试”该程序。但我要么不确定可执行文件的外观,要么不确定如何运行它。或者有什么东西不工作。 makefile 所做的只是创建一个 testBSTree.o,我真的不知道如何处理该文件。

#  Makefile
# a makefile for the stack example.
#

# SHELL = /bin/sh

# TOP = .
# CURRENT_DIR = .

# CPP = /lib/cpp $(STD_CPP_DEFINES)
CXX = g++

# CCOPTIONS =
# CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES)
# RM_CMD = $(RM) *.o core

SRCS= testBSTree.cpp \
BSTree2.cpp

OBJS= testBSTree.o \
BSTree2.o

testBSTree.o: BSTree2.h

BSTree2.o: BSTree2.h #?

#link.o: link.h #?

PROGRAMS = testBSTree

all:: $(PROGRAMS)


testBSTree: $(OBJS)
$(CXX) -o $@ $(OBJS)
#$(CXX) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS)

clean::
$(RM) testBSTree

latex::
latex BSTree2.tex

###########################################################################
# common rules for all Makefiles - do not edit

emptyrule::

clean::
rm *.o

如有任何帮助,我们将不胜感激。谢谢!

最佳答案

尝试:

make all

编译一切。

或者将all:: 目标放在testBSTree.o: 之前,然后您只需键入make。如果不指定目标,make 默认为 makefile 中的第一个目标。

关于c++ - 为什么我的 Makefile 没有创建可执行文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14805572/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com