SaltyCrane Blog — Notes on JavaScript and web development

How to use Eclipse and CDT to edit C source files

Eclipse is a good integrated development environment rivaling Microsoft Visual Studio 2005. I have Visual Studio 2005 installed on my computer, though for some reason, I don't care to use it. Eclipse originally was used for Java development but now includes plugins for C/C++, Python, Perl, and many others. I use the Pydev plugin for Python development and it is good.

I am using Tornado 2.2 to develop C code for VxWorks. The editor in Tornado isn't the greatest, so I want to edit my code in Eclipse with the CDT plugin. I will still be using Tornado to build the projects, so instead of using a Standard or Managed Make Project, I just created a folder which linked to my source files. Note that you may get messages in Tornado that say "This file has been changed outside the source editor. Do you want to reload it?" Just make sure you don't have any unsaved changes from Tornado and click "Yes". Or just make sure all your source code windows are closed in Tornado. I know this isn't the most elegant solution, but it will have to do unless we upgrade to VxWorks 6 and Workbench.

Update 2/13/07: I've found a better way to use Eclipse with Tornado projects. See my post How to use Tornado GNU tools with Eclipse/CDT for how to use Eclipse to edit *and build* your Tornado project.

Here are the steps:
  1. Start with your .c and .h files in a directory called "c:\sofeng\proj\stuff"
  2. Download and install eclipse-SDK-3.2.1-win32.zip from http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops/R-3.2.1-200609210945/eclipse-SDK-3.2.1-win32.zip
  3. Download and install org.eclipse.cdt-3.1.1-win32.x86.zip from http://download.eclipse.org/tools/cdt/releases/callisto/dist/3.1.1/
  4. Run "eclipse.exe"
    5. From the menu: "Window" -> "Open Perspective" -> "Other..." -> "C/C++" -> "OK"
  5. From the menu: "File" -> "New" -> "Other..."
  6. Under "General", select "Project"
  7. Click "Next"
  8. In the "Project name:" field, type "dummy". Leave the "Use default location" box checked.
  9. Click "Finish"
  10. From the menu: "File" -> "New" -> "Folder"
  11. In the "Enter or select the parent folder:" enter or select the "dummy" project you just created.
  12. Click the ">> Advanced" button
  13. Click the "Link to folder in the file system" checkbox and enter "c:\sofeng\proj\stuff" or "Browse..." to that location.
  14. Click "Finish"
NOTE: If you do not see the ">> Advanced" button, follow these steps:
  1. From the "Window" menu, select "Preferences..."
  2. Go to "General" > "Workspace" > "Linked Resources" and check "Enable linked resources"
  3. Click "OK"

Comments


#1 Manoj commented on :

This method seems to work but quite a few options don't such as syntax highlighting and outline view.