Eclipse C ++多个项目的通用文件 [英] Eclipse C++ multiple projects common files

查看:56
本文介绍了Eclipse C ++多个项目的通用文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Eclipse/CDT中,我希望有几个C ++项目(projA,projB,projC等),它们都包含一些 .c .cpp 和/或来自公共目录的 .h 文件.这是我现有的文件结构:

In Eclipse/CDT, I wish to have several C++ projects (projA, projB, projC, etc.) that will all include some .c, .cpp and/or .h files from a common directory. Here is my existing file structure:

Workspace -> projA -> src
          -> common ->src : a.c a.h  b.cpp  c.cpp  d.c  etc.
          -> projB -> src
          -< projC -> src

当我尝试将../common/src中的源文件添加到projA时,添加源文件"工具会抱怨该文件必须在项目中.

When I attempt to add a source file in ../common/src to projA, the Add a Source File tool complains that the file must be in the project.

那么,如何将../common/src/a.c包含到../projA-> src中?

So, how do I include, say ../common/src/a.c into ../projA -> src?

推荐答案

Eclipse有一个名为添加新源文件夹"的选项,并且在该对话框中有一个选项可以链接到现有目录.您可以在指向相同目录的所有项目中将公共"文件夹链接为源文件夹.

Eclipse has an option called add new source folder and an option in that dialogue to link to existing directory. You can link the "common" folder as a source folder in all of the projects pointing to the same directory.

右键单击项目->新建->文件夹->高级->链接到备用位置

Right click on project -> New -> Folder -> Advanced -> Link to alternate location

一旦添加了文件夹,

右键单击文件夹->路径->用作源文件夹

Right click on Folder -> Buld Path -> Use as source folder

这篇关于Eclipse C ++多个项目的通用文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆