Reputation: 62746
I am trying to map my Visual Studio experience onto Eclipse. Right now, I wish to add a file existing somewhere on the file system into a project in Eclipse. I expect it to be copied to the project source folder.
Currently, I see only one way - switch to the windows explorer (total commander, in my case) and copy the file myself, after which to refresh the project.
Can I do the same without leaving the Eclipse IDE?
Thanks.
Upvotes: 63
Views: 81305
Reputation: 1
Right-click on the file after you have copied it into the project directory. Select Properties... in the left hand pane select C/C++ Build. There will be a checkbox "Exclude resource from build" uncheck that check box.
Upvotes: 0
Reputation: 31
Just found the quickest way to add files:
Copy-paste your file into your project disk directory using your file browser.
In Eclipse project browser select your project.
Click [right mouse button]->Refresh (or press F5 on Windows machine).
Voila
(worked on Neon-4.6.2)
Upvotes: 3
Reputation: 51
I am a newbie to Eclipse Luna (the 64 bit latest version on Windows 7) but this worked for me:
Upvotes: 5
Reputation: 135
It turns out that just simply dragging the files into the src folder would work!
Upvotes: 0
Reputation: 395
In my case, I had to:
Refreshing didn't work for me. :(
Hopefully this helps someone else...
Upvotes: 3
Reputation: 1108
I had the same problem, but found yet another solution.
Let me state my problem so that we're sure we're talking about the same thing.
I had a file in a directory where a bunch of code files were and some of the files in that directory were shown as "in my project" and some of the files were missing. I wanted the missing files to appear in my project.
I simply selected the folder in my project and pressed 'F5' or right-clicked and selected 'refresh' and the files appeared in my project. It looks like that is the intended way of doing this.
Upvotes: 77
Reputation: 789
Even easier. Just drag and drop the file from explorer into the correct package in Eclipse. It will ask you if you want to copy or link the file(s).
Upvotes: 14
Reputation: 2241
I just got this to work. YMMV
I don't suppose it has to be there, but I put my file, xyz.cpp, into my project's source directory. My project has a source subdir named src, as in ProjName/src.
Right Click on project name (my project was open and the only one open). NEW->FILE. Put in the filename, xyz.cpp. Click OK or press enter.
The file will open in the editor and complain that it is empty. Close it WITHOUT SAVING.
Reopen the file. It now has its contents.
Upvotes: 0
Reputation: 42040
File->Import->General->File System
should do it.
There you can select the file(s) from some file system folder to your project (into folder
).
Upvotes: 43