如何打开eclipse java和c ++项目指向同一个根目录

时间:2023-01-24 16:35:08

I have a directory which has both java/c++ code (they are in different sub-directories, multiple of them). How to open a eclipse java and a c++ project point to the same root directory? eclipse won't let me, saying something like 'there is a project exists in the same location'

我有一个目录,其中包含java / c ++代码(它们位于不同的子目录中,其中有多个)。如何打开eclipse java和c ++项目指向同一个根目录? eclipse不会让我,说'有一个项目存在于同一个位置'

Thank you.

2 个解决方案

#1


In java project build path settings, you can point to external folders to build from. "Link additional source: use this if you have a folder in the file system that should be used as additional source folde"

在java项目构建路径设置中,您可以指向要构建的外部文件夹。 “链接其他来源:如果您在文件系统中有一个应该用作附加源文件夹的文件夹,请使用此选项”

So you could have your C++ project pointing to the main folder, then create a java project in a different dir and then use the above mechanism to compile all the java source. Not a great solution, since you have two projects and two different working dirs.

所以你可以让你的C ++项目指向主文件夹,然后在另一个dir中创建一个java项目,然后使用上面的机制来编译所有的java源代码。不是一个很好的解决方案,因为你有两个项目和两个不同的工作目录。

What I can tell you for sure, is that you can only have one project per location on the file system, since eclipse creates a whole bunch of metadata dirs etc..

我可以肯定的是,你可以在文件系统上每个位置只有一个项目,因为eclipse创建了一大堆元数据目录等。

My only other thought is if you could create a project that builds Java and C++. Eclipse has the concept of builders and natures. Somehow you need a project with Java and C++ natures/builders...

我唯一的另一个想法是你是否可以创建一个构建Java和C ++的项目。 Eclipse具有构建器和性质的概念。不知何故,你需要一个带有Java和C ++性质/构建器的项目......

I did a quick google and it looks like this post covers both of these options: http://lorinc.blogspot.com/2006/10/how-to-mix-java-and-c-code-in-singe.html

我做了一个快速谷歌,看起来这篇文章涵盖了这两个选项:http://lorinc.blogspot.com/2006/10/how-to-mix-java-and-c-code-in-singe.html

#2


I'm not sure if I understood correctly
You have:

我不确定我是否理解正确你有:

"workspace\project\" which contains both projects together?
I don't think you can, since eclipse creates some files (such as .project) for every project.. if both share the same directory, then eclipse would need two files, one name, one location.

“workspace \ project \”包含两个项目在一起?我不认为你可以,因为eclipse为每个项目创建了一些文件(例如.project)..如果两者共享同一个目录,那么eclipse需要两个文件,一个名称,一个位置。

I suggest moving the C project into some other folder.

我建议将C项目移动到其他文件夹中。

#1


In java project build path settings, you can point to external folders to build from. "Link additional source: use this if you have a folder in the file system that should be used as additional source folde"

在java项目构建路径设置中,您可以指向要构建的外部文件夹。 “链接其他来源:如果您在文件系统中有一个应该用作附加源文件夹的文件夹,请使用此选项”

So you could have your C++ project pointing to the main folder, then create a java project in a different dir and then use the above mechanism to compile all the java source. Not a great solution, since you have two projects and two different working dirs.

所以你可以让你的C ++项目指向主文件夹,然后在另一个dir中创建一个java项目,然后使用上面的机制来编译所有的java源代码。不是一个很好的解决方案,因为你有两个项目和两个不同的工作目录。

What I can tell you for sure, is that you can only have one project per location on the file system, since eclipse creates a whole bunch of metadata dirs etc..

我可以肯定的是,你可以在文件系统上每个位置只有一个项目,因为eclipse创建了一大堆元数据目录等。

My only other thought is if you could create a project that builds Java and C++. Eclipse has the concept of builders and natures. Somehow you need a project with Java and C++ natures/builders...

我唯一的另一个想法是你是否可以创建一个构建Java和C ++的项目。 Eclipse具有构建器和性质的概念。不知何故,你需要一个带有Java和C ++性质/构建器的项目......

I did a quick google and it looks like this post covers both of these options: http://lorinc.blogspot.com/2006/10/how-to-mix-java-and-c-code-in-singe.html

我做了一个快速谷歌,看起来这篇文章涵盖了这两个选项:http://lorinc.blogspot.com/2006/10/how-to-mix-java-and-c-code-in-singe.html

#2


I'm not sure if I understood correctly
You have:

我不确定我是否理解正确你有:

"workspace\project\" which contains both projects together?
I don't think you can, since eclipse creates some files (such as .project) for every project.. if both share the same directory, then eclipse would need two files, one name, one location.

“workspace \ project \”包含两个项目在一起?我不认为你可以,因为eclipse为每个项目创建了一些文件(例如.project)..如果两者共享同一个目录,那么eclipse需要两个文件,一个名称,一个位置。

I suggest moving the C project into some other folder.

我建议将C项目移动到其他文件夹中。