C++ Eclipse CDT 生成的 Makefile 在哪里?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4331960/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 15:08:32  来源:igfitidea点击:

Where is the Makefile generated by the Eclipse CDT?

c++eclipsemakefileeclipse-cdt

提问by firsttestcdt

I've built a hello world C++ project with Eclipse(helios) CDT. It compiled fine. But I would like to take a look at the Makefile CDT generated. I can't find it in project folder/debug/release folders or in the src folders. Where can I find this Makefile?

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

采纳答案by ahala

If you use the default setttings with current builder = CDT internal builder, there is no make file. if you select current builder = GNU make, you will see the makefile in the debug folder.

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

回答by HugoPoi

On Windows,

在 Windows 上,

Click your project, go to menu project-> properties, select Tool Chain Editorthen select in Current BuilderGnu Make Builder.

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

Build a target now generate makefile.

构建目标现在生成 makefile。

Current builder Gnu Make Builder

当前构建器 Gnu Make Builder

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

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

回答by Itamar Katz

The only thing I can think of is that the makefile isn't created. Click your project, go to menu project-> properties, select C/C++ Buildin the left pane, and make sure the Generate Makefiles automaticallycheckbox is checked.

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

回答by belwood

By default you should have [workspace]/[project folder]/Debug/makefile. Have you made any changes to the default environment?

默认情况下,您应该有 [workspace]/[project folder]/Debug/ makefile。您是否对默认环境进行了任何更改?

Here's the HelloWorld sample project makefile from a Helios (windows/cygwin) installation:

这是 Helios (windows/cygwin) 安装中的 HelloWorld 示例项目生成文件:

################################################################################
# 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