如何在eclipse cdt环境下 导入一个含makefile的工程文件

 我来答
EvenHHZ
2016-09-09 · 知道合伙人软件行家
EvenHHZ
知道合伙人软件行家
采纳数:13691 获赞数:18845
个人出版图书:《玩转Python网络爬虫》、《玩转Django2.0》

向TA提问 私信TA
展开全部
原文

Tutorial: Importing an existing project

The following tutorial takes you though the process of importing a 'legacy' application using the CDT.
Step 1: You want to create a single project that will reflect all of the components for the existing source tree.

Select File > New > Project.
For this tutorial, expand C/C++ and select C++ project.

The New Project wizard displays. Click here to see an illustration (displayed in a separate window).

In the Project name field, type a name for the project.
Ensure that the Use default location option is not selected because here we will specify where the resources reside in the file system, in a location other than your workspace.
We assume this directory location already exists, and contains e.g. source files and makefile. If it does not exist, it will be created.
In this example, we will use an existing hello.cpp and its existing hello.mak makefile, located in the directory c:\brandon.
Click here to see an illustration (displayed in a separate window).
In the Location field, specify the path to the existing files for your project.
From the Project types list, expand Makefile Project and select Empty Project..
To have sample source and a makefile created in your existing directory, select Hello World C++ Project
Make sure a toolchain is selected.
Click Next.

(Optional) On the Select Configurations page, select only the configurations you want created. Configurations display for each toolchain selected on the previous page of the wizard.
Click Finish to close the dialog box.
You will see the new project in the Project Explorer view. In addition, new 'dot' files have been created in your legacy project's root directory, these are CDT project files.
(Optional) To see these "hidden" files, open the view menu on the Project explorer view, and select "Customize View."
The view menu is activated via the small downward-pointing triangle in the upper right of the toolbar of the view.
Click here to see an illustration (displayed in a separate window).

In the Available Customizations window, on the Filters tab, uncheck ".* resources."
Click here to see an illustration (displayed in a separate window).

The formerly hidden 'dot' files are now shown in the Project Explorer.
Click here to see an illustration (displayed in a separate window).

Hit OK to close the dialog.
Step 2: You are now ready to build your project.

To build your project, select Project > Build Project.
You can also hit the hammer icon on the toolbar to build the selected project.

You may see an error e.g. "make: *** no rule to make target 'all'.
This is because, in our case, we didn't tell it where the makefile is, or its name.
After the project build completes, the results display in the Console view and new objects, such as binaries and includes, show in the Project Explorer view.
Click here to see an illustration (displayed in a separate window).

Open the project properties (right mouse on project name in the Project Explorer view and select Properties at the bottom on the context menu).
On the C/C++ Build Page, on its Builder Settings tab, uncheck Use default build command and change the make command to make -f hello.maksince our makefile is not named the default makefile.
Click here to see an illustration (displayed in a separate window).
Click OK to close the Project Properties window.
Your project will probably rebuild. If not you can force a build via Project > Build Project or use the hammer icon .
Review the results to ensure that there are no errors.

Note: By default, the indexer is set to Fast indexer for the project to parse your project in the same way that a compiler does; beginning with each compilation unit and parsing that file and all files that it includes, except that it parses each header file included in a project only once. This method provides the most accurate index information. For large projects using complex C++ code, this indexer can be slow. For example, if a header file is included and takes two compilation units, the parsing of the second unit reuses the results of parsing the first unit. This is similar to how precompiled headers work. The indexing of large projects using the Fast indexer uses fewer resources than the Full indexer, but the resulting index is not quite as accurate.
To change indexer settings, bring up the Indexer page in the Project Properties.
Click here to see an illustration (displayed in a separate window).
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式