Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Create project from existing files
Create project from existing files [message #1732321] Sun, 15 May 2016 19:20 Go to next message
Ale Bez is currently offline Ale BezFriend
Messages: 3
Registered: May 2016
Junior Member
Sorry for the silly question from windows user Embarrassed .
I have inherited a bunch of files which suppose to be an Eclipse project.
I got:
MyProgect
  |-Debug
  |  |  makefile
  |  |  objects.mk; 
  |  |  sources.mk
  |-src
  |  |  main.cpp
  |  |  MyProject.cpp

No .cproject or .project files.

How do I properly create an Eclipse project from it?
I've tried File-New-Makefile project with existing code
It asks me for Existing code location.
If I point to MyProject directory it doesn't see anything...
If I point to src directory Eclipse doesn't see makefile
If I point to Debug directory it doesn't see source files

Thanks!!!
Re: Create project from existing files [message #1732399 is a reply to message #1732321] Mon, 16 May 2016 21:10 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
Since you already have a makefile, you can create a project with File --> New --> Project --> C/C++ --> Makefile Project with Existing Code.

The dialog that pops up asks for the name of the project and the location. Make the location the main directory. and pick whatever project name your want. Then hit Finish. The project structure will mimc all files in the directory you've named and all subdirectories, too. You can verify this in the Project View.

Quote:
I've tried File-New-Makefile project with existing code
It asks me for Existing code location.
If I point to MyProject directory it doesn't see anything...

Are you sure this is what you did? The latest versions of Eclipse/CDT don't have a menu path File-New-Makefile project with existing code . What version of Eclipse and CDT are you using?

This is the listing of files in a directory named EASEA
index.php/fa/25927/0/

And this is the project view after creating the project.
index.php/fa/25928/0/

[Updated on: Mon, 16 May 2016 21:39]

Report message to a moderator

Re: Create project from existing files [message #1732410 is a reply to message #1732399] Tue, 17 May 2016 03:32 Go to previous messageGo to next message
Ale Bez is currently offline Ale BezFriend
Messages: 3
Registered: May 2016
Junior Member
David,
Thank you for your answer!

>What version of Eclipse and CDT are you using?
I just downloaded "Eclipse IDE for C/C++ Developers" MARS.2
Honestly, I expected it to come with gcc and g++ compilers but that wasn't the case, so I downloaded sygwin64 with developer tools.
>don't have a menu path File-New-Makefile project with existing code
It definitely has it Smile

I followed your suggestion, pointed to the MyProject folder and hit Finish, but Project Explorer is empty...
I can import folder src But then it seems that Eclipse doesn't see my make file which is in the debug folder.

This shouldn't be so difficult...
Re: Create project from existing files [message #1732469 is a reply to message #1732410] Tue, 17 May 2016 14:05 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
Quote:
If I point to MyProject directory it doesn't see anything...
I followed your suggestion, pointed to the MyProject folder and hit Finish, but Project Explorer is empty...



Well, I'm using MARS.1 and contrary to the mars sr1 documentation:
http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Freference%2Fcdt_u_new_proj_wiz.htm&cp=10_4_8

I get this after File --> New --> Project
index.php/fa/25939/0/

According to this:
http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Fconcepts%2Fcdt_c_projects.htm

Quote:
Makefile Project - Creates an empty project without the meta-data files.


Whatever that means. If your project is truly empty then I guess you need to use File --> Import after creating the project.

There must be a .cproject file in the main project directory and that should show up in the project view unless it is being filtered.

What I don't understand is that when you target your project to the Debug you apparently have the files and the project is not empty. The only difference is that your project has only directories. There should be a directory structure in the project. When I do it, I get the expected structure. Maybe it's a bug or maybe not. Eclipse documentation is not entirely reliable. Menus changes seem to occur with every release. So, who knows?

Maybe you can post the image of the project view when targeting the MyProj directory.

BTW: Eclipse expects that the main project directory contains a master make file which recurses into the selected configuration directory (usually Debug and Release). I don't have separate configurations for these so I have only one make file. Personal thing,. If the only differences is whether the executable contains debug info, there are tools for removing it. If there are other differences such as different code then you are releasing code which you haven't debugged/verified if you don't have a separate test and verification process.


  • Attachment: ProjWiz2.png
    (Size: 35.00KB, Downloaded 11699 times)

[Updated on: Tue, 17 May 2016 14:24]

Report message to a moderator

Re: Create project from existing files [message #1732666 is a reply to message #1732469] Thu, 19 May 2016 03:24 Go to previous message
Ale Bez is currently offline Ale BezFriend
Messages: 3
Registered: May 2016
Junior Member
I figured it out I think. So I have
MyWorkspace
|-MyProject
|  |-src
|  |  |  main.cpp
|  |  |  MyProject.cpp
|  |-Debug
|  |  |  makefile
|  |  |  objects.mk; 
|  |  |  sources.mk


and I do: Start Eclipse
select workspace- MyWorkspace
File-New-C++ project
Project name MyProject; Default location (MyWorkspace\MyProject); Project Type Executable Empty Project

This creates a project, project files
MyWorkspace\MyProject\.cproject;
MyWorkspace\MyProject\.project
and does see my source files and my makefile in the Debug subfolder
Previous Topic:properties-> c++ build not found
Next Topic:I have a program already ten days
Goto Forum:
  


Current Time: Thu Apr 18 05:49:23 GMT 2024

Powered by FUDForum. Page generated in 0.01815 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top