如何使用 Eclipse 打开现有的 C++ 项目?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23786112/
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
How to open existing C++ project with Eclipse?
提问by Dzyann
I have two projects in C++ that I need to run and build both in Windows and Linux. We are using Microsoft TFS for source control.
我有两个 C++ 项目,需要在 Windows 和 Linux 中运行和构建。我们使用 Microsoft TFS 进行源代码控制。
- For windows we are using Visual Studio.
- For Linux we are using Eclipse. (I don't have much experience with Eclipse)
- 对于 Windows,我们使用 Visual Studio。
- 对于 Linux,我们使用 Eclipse。(我对 Eclipse 没有太多经验)
I had managed to configure and build properly the projects in both platforms.
我已经设法在两个平台上正确配置和构建项目。
I checked in TFS the .cprojectand .projectfrom eclipse, so I can use it in another computer.
我从 eclipse 中检入了.cproject和.project 的TFS ,所以我可以在另一台计算机上使用它。
Now I am trying to get the projects in another Linux computer and I don't know how to do it.
现在我试图在另一台 Linux 计算机上获取项目,但我不知道该怎么做。
I tried following this instructions, but I don't have my source code zipped.
我尝试按照此说明进行操作,但我没有压缩源代码。
Other places like heresuggest creating a new project.
像这里这样的其他地方建议创建一个新项目。
Isn't there a way to open an existing project in Eclipse similar to Visual Studio?
没有办法在 Eclipse 中打开一个类似于 Visual Studio 的现有项目吗?
Do I have to create a new project? If so, how can I keep the configurations I did to be able to build the project so other developer can use them?
我必须创建一个新项目吗?如果是这样,我如何保留我为构建项目所做的配置,以便其他开发人员可以使用它们?
回答by jasal
File > Import... > General > Existing projects into workspace
文件 > 导入... > 常规 > 现有项目到工作区
Don't select an archive file. Set the root directory to where your .project
and .cproject
files are located. Your project should show up in the list. Make sure you don't forget to check the checkbox in front of your project.
不要选择存档文件。将根目录设置为您的.project
和.cproject
文件所在的位置。您的项目应该显示在列表中。确保您不要忘记选中项目前面的复选框。
Committing eclipse project files to a version control system is perfectly fine as long as you don't use absolute paths in your project settings. Use environment variables to specify paths which differ between developer machines.
只要您不在项目设置中使用绝对路径,将 Eclipse 项目文件提交到版本控制系统就完全没问题。使用环境变量来指定不同开发者机器的路径。