简体   繁体   English

如何用Eclipse打开现有的C ++项目?

[英]How to open existing C++ project with Eclipse?

I have two projects in C++ that I need to run and build both in Windows and Linux. 我有两个C ++项目,我需要在Windows和Linux中运行和构建。 We are using Microsoft TFS for source control. 我们使用Microsoft TFS进行源代码管理。

  • For windows we are using Visual Studio. 对于Windows,我们使用的是Visual Studio。
  • For Linux we are using Eclipse. 对于Linux,我们使用的是Eclipse。 (I don't have much experience with Eclipse) (我对Eclipse没有太多经验)

I had managed to configure and build properly the projects in both platforms. 我曾设法在两个平台上正确配置和构建项目。

I checked in TFS the .cproject and .project from eclipse, so I can use it in another computer. 我在TFS中检查了eclipse中的.cproject.project ,所以我可以在另一台计算机上使用它。

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 here suggest 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? 如果是这样,我如何保持我所做的配置能够构建项目,以便其他开发人员可以使用它们?

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. 将根目录设置为.project.cproject文件所在的位置。 Your project should show up in the list. 您的项目应显示在列表中。 Make sure you don't forget to check the checkbox in front of your project. 确保您不要忘记选中项目前面的复选框。

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. 只要不在项目设置中使用绝对路径,就可以将eclipse项目文件提交到版本控制系统。 Use environment variables to specify paths which differ between developer machines. 使用环境变量指定开发人员计算机之间不同的路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM