Eclipse CDT生成的Makefile在哪里?

时间:2010-12-02 05:23:13

标签: c++ eclipse makefile eclipse-cdt

我用Eclipse(helios)CDT构建了一个hello world C ++项目。它汇编得很好。但我想看一下生成的Makefile CDT。我在项目文件夹/调试/发布文件夹或src文件夹中找不到它。我在哪里可以找到这个Makefile?

4 个答案:

答案 0 :(得分:17)

如果您使用current builder = CDT internal builder的默认设置,则没有make文件。 如果选择current builder = GNU make,您将在调试文件夹中看到makefile。

答案 1 :(得分:16)

在Windows上,

点击您的项目,转到菜单project - > properties,选择Tool Chain Editor,然后选择Current Builder Gnu Make Builder

现在构建一个目标生成makefile。

Current builder Gnu Make Builder

http://help.eclipse.org/helios/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Freference%2Fcdt_u_prop_build_toolchain.htm

答案 2 :(得分:5)

默认情况下,你应该有[工作区] / [项目文件夹] / Debug / makefile 。您是否对默认环境进行了任何更改?

这是来自Helios(windows / cygwin)安装的HelloWorld示例项目makefile:

################################################################################
# Automatically-generated file. Do not edit!
################################################################################

-include ../makefile.init

RM := rm -rf

# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include src/subdir.mk
-include objects.mk

ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C++_DEPS)),)
-include $(C++_DEPS)
endif
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
ifneq ($(strip $(CC_DEPS)),)
-include $(CC_DEPS)
endif
ifneq ($(strip $(CPP_DEPS)),)
-include $(CPP_DEPS)
endif
ifneq ($(strip $(CXX_DEPS)),)
-include $(CXX_DEPS)
endif
ifneq ($(strip $(C_UPPER_DEPS)),)
-include $(C_UPPER_DEPS)
endif
endif

-include ../makefile.defs

# Add inputs and outputs from these tool invocations to the build variables

# All Target
all: HelloWorld.exe

# Tool invocations
HelloWorld.exe: $(OBJS) $(USER_OBJS)
        @echo 'Building target: $@'
        @echo 'Invoking: Cygwin C++ Linker'
        g++  -o"HelloWorld.exe" $(OBJS) $(USER_OBJS) $(LIBS)
        @echo 'Finished building target: $@'
        @echo ' '

# Other Targets
clean:
        -$(RM) $(C++_DEPS)$(OBJS)$(C_DEPS)$(CC_DEPS)$(CPP_DEPS)$(EXECUTABLES)$(CXX_DEPS)$(C_UPPER_DEPS) HelloWorld.exe
        -@echo ' '

.PHONY: all clean dependents
.SECONDARY:

-include ../makefile.targets

答案 3 :(得分:5)

我唯一能想到的是没有创建makefile。点击您的项目,转到菜单project - > properties,在左侧窗格中选择C/C++ Build,并确保选中Generate Makefiles automatically复选框。