Sunday, June 15, 2014

Getting Started with C and Eclipse (for Emma)


(6/15)Emma, (and any other UCSD rising sophmores), Here's what I recommend in order to get started on C under Eclipse:


  1. Download the latest Eclipse(Kepler SR2). I got it from here. 
  2. Install the C Dev Tools package thusly:
    1. Copy this: http://download.eclipse.org/tools/cdt/releases/kepler
    2. Go to Help>Install New Software
    3. Click Add
    4. In "Name" type "CDT" or something.
    5. Paste the url above into the Location field. Click OK.
    6. In the "Work With" field, type CD. it will auto complete to the CDT.
    7. Click both CDT Main Features and CDT Optional Features.
    8. Click Finish, and click yes on the license radio buttons.
    9. You will have to restart Eclipse
    10. Download a C compiler. I assume its on a mac, so I have no idea how to do that. (Still a hardened windows/linux guy. But this post seems to know what to do.
    11. Once you do that go into eclipse
    12. Go to File>New>Project...
    13. Choose c/c++ project
      1. Ignore any warnings about g++ if you get them.
    14. Create a file called main.c
    15. Paste this into it:

/* Hello World program */

#include

main()
{
    printf("Hello World");
}

Then do "Project>Build All" and then a Debug.

Then its all pretty standard.

FYI:
This is a decent handout from Stanford with some ideas on install and debugging.