Difference between revisions of "C Projects in Eclipse"

From DiLab
Jump to: navigation, search
Line 19: Line 19:
* Ctrl+Tab - switch between source and header files (.c and .h)
* Ctrl+Tab - switch between source and header files (.c and .h)
* F3 or Ctr+Left click on a function, variable, macro - go to its declaration/definition. The definition outline will be displayed automatically, if you hold mouse over a function/variable/macro name.
* F3 or Ctr+Left click on a function, variable, macro - go to its declaration/definition. The definition outline will be displayed automatically, if you hold mouse over a function/variable/macro name.
* Ctrl+H - workspace wide search. Choose "File search". Type in your keyword and file pattern (I use "*.S, *.c, *.h" to search C source/header and ASM files).
* Ctrl+H - workspace wide search. Choose "File search". Type in your keyword and file pattern (I use "*.S, *.c, *.h" to search C source/header and ASM files). To avoid annoying C++/Task search, I choose "Customize"in the Search window and uncheck all the unnecessary alternatives, leaving only "File Search" checked.

Revision as of 17:23, 22 November 2009

  • Download Eclipse CDT - from the list Choose "Eclipse IDE for C/C++ Developers".
  • Unarchive and run downloaded Eclipse
  • Close "Welcome screen", if you're running Eclipse for the first time
  • Choose File > New > C Project
  • Type in a name, for example, lab03
  • Uncheck "Use default location"
  • Browse you lab root folder as Location
  • Choose "Makefile Project > Empty project" as Project type
  • Press "Finish"
  • A New project folder will appear on the left side, right click on it, properties
  • C/C++ General > Paths And Symbols > GNU C++
  • Add ... > Workspace
  • Choose your lab project root folder (lab03), OK, OK, OK

Now you should be able to work with your project.

Keyboard shortcuts worth knowing (On MacOS Ctrl must be replaced by Cmd for most of the shortcuts):

  • Ctrl+B - build your project. Check Console window for error messages
  • Ctrl+Tab - switch between source and header files (.c and .h)
  • F3 or Ctr+Left click on a function, variable, macro - go to its declaration/definition. The definition outline will be displayed automatically, if you hold mouse over a function/variable/macro name.
  • Ctrl+H - workspace wide search. Choose "File search". Type in your keyword and file pattern (I use "*.S, *.c, *.h" to search C source/header and ASM files). To avoid annoying C++/Task search, I choose "Customize"in the Search window and uncheck all the unnecessary alternatives, leaving only "File Search" checked.