Linux 如何将C makefile项目导入eclipse或放在eclipse下

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9794967/
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-06 05:17:50  来源:igfitidea点击:

How to import C makefile project into eclipse or put in under eclipse

c++clinuxeclipsemakefile

提问by Dims

I have standard source code package under Linux which requires to run

我在 Linux 下有标准的源代码包,需要运行

./configure
make

to compile it (and it works ok).

编译它(它工作正常)。

Mostly these files are C/C++

这些文件大多是 C/C++

Is it possible to put this project under Eclipse control? I wish to browse definitions etc...

是否可以将此项目置于 Eclipse 控制之下?我想浏览定义等...

UPDATE 1

更新 1

I have Eclipse Indigo running on Ubuntu. It contains CDT of course.

我在 Ubuntu 上运行 Eclipse Indigo。它当然包含CDT。

When I choose File-Import, I see no matching option under C/C++. Under GeneralI have Existing Projects into Workspacebut I get No project are found to importif I point this wizard to my project root.

当我选择时File-Import,我在C/C++. 在General我有,Existing Projects into WorkspaceNo project are found to import如果我将此向导指向我的项目根目录,我会得到。

UPDATE 2

更新 2

I have installed Eclipse with Ubuntu package manager. Probably this was wrong.

我已经用 Ubuntu 包管理器安装了 Eclipse。可能这是错误的。

采纳答案by manasij7479

First run the ./configure to generate the Makefile. After that, if you have CDT installed,just choose the option "File->New->Makefile Project With Existing Code" and point to the directory where the Makefile is stored.

首先运行 ./configure 以生成 Makefile。之后,如果您安装了CDT,只需选择选项“File->New->Makefile Project With Existing Code”并指向存储Makefile的目录。

回答by ernesto

Don't say import.

不要说进口。

Create a new C/C++ project using the New Project Wizard, and specify the "root folder" as a non-default location of the new project.

使用新建项目向导创建一个新的 C/C++ 项目,并将“根文件夹”指定为新项目的非默认位置。

See the instructions here.

请参阅此处的说明。

Read "Creating new projects from existing source roots"

阅读“从现有源根创建新项目”

回答by r11

Create a new project, make sure to uncheck the "Use default location" option while doing so. Add your source tree path in the location field. Now select "Makefile Project" in the project types window.

创建一个新项目,确保在执行此操作时取消选中“使用默认位置”选项。在位置字段中添加您的源树路径。现在在项目类型窗口中选择“Makefile Project”。

In "builder settings" (Project>Properties), uncheck the "use default build command" and add:

在“构建器设置”(项目>属性)中,取消选中“使用默认构建命令”并添加:

make -f /<your project location/Makefile

If your makefile is named otherwise, you can change it here.

如果您的 makefile 以其他方式命名,您可以在此处更改它。

To run your application, add the application in Run Configurations. See full instructions here.

要运行您的应用程序,请在运行配置中添加应用程序。请参阅此处的完整说明。