Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » Simple Adding of Existing C Files to Projects(Ways to simplify adding existing c files to projects in eclipse)
Simple Adding of Existing C Files to Projects [message #736077] Thu, 13 October 2011 10:06 Go to next message
Eclipse UserFriend
Hi Guys

I am really finding that trying to add existing c files to my project is extremely cumbersome - I'm almost 100% sure that I am doing something wrong and hope you could help me!

I have an existing C project in eclipse that lives in the workspace. Only my main.c file is in the actual workspace, and I want to include c files checked out using tortoise svn ( I am running windows 7 ) from various locations on my hard drive.

What I typically do to accomplish this:
1. Right Click on the Project
2. Select New -> Folder
3. Select Advanced, 'Link to alternate location)
4. Browse to the folder I want to include
5. Select Finish

The folder is now in my workspace. This is very cumbersome if you have multiple folders you wish to add - and especially if you copy the workspace to a different PC and all the paths need updating. The second step is to set-up the include directories for the compiler so it actually knows where the files are. My eclipse auto-detects a MINGW GCC installation somewhere on my machine. These steps does it:

1. Right click on the project, select 'Properties'
2. Select C/C++ General -> Paths and Symbols
3. Click GNU C on the Includes Tab under languages
4. Click Add - > Workspace
5. Select the folder you just added

Finally I can compile. I do not wish to have my c files in my workspace, so using eclipse to checkout from svn into the workspace is not what I want to do (also against project policy for some reason). Saying that, importing and making a copy of the files in the workspace is also out of the question.

Is there a simpler way to do all of this? Basically I need to be able to set-up a relative path to my c files, and have eclipse update all necessary paths such that the active compiler is aware of the source location.


Any help is much appreciated!

[Updated on: Thu, 13 October 2011 10:10] by Moderator

Re: Simple Adding of Existing C Files to Projects [message #736105 is a reply to message #736077] Thu, 13 October 2011 11:28 Go to previous message
Eclipse UserFriend
Projects don't have to reside in the workspace. The location of the project can be most anywhere on your filesystem. When you create the project, uncheck the Use Default Location and browse to a location where you want to project to reside.

You can also use Path Variables to point to locations in your filesystem. Creating links based on the Path Variables will allow you to move the projects between workspaces/systems. The Path Variable is defined in the workspace.
Previous Topic:Project repeated under working set
Next Topic:Fortran Function from C
Goto Forum:
  


Current Time: Fri Jul 18 13:42:08 EDT 2025

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

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

Back to the top