Pthreads and Eclipse IDE

Have you come across a situation where a C/C++ project that uses Pthread API fails to compile via the Eclipse IDE?

If your answer to the above question is ‘YES’, then this post is for you.

The CDT plugin in the Eclipse IDE is not configured to add the -pthread argument when the user tries to compile a C/C++ project. Please follow the steps listed below to successfully compile a C/C++ project which uses Pthread library in Eclipse.

  • Open Eclipse (it is assumed that CDT plugin is installed).
  • On the menu bar, choose Projects->Properties.
  • From the bar on the left, choose c/c++ build –> GCC C Compiler –> Miscellaneous.
  • Add the -pthread argument into the beginning of the Other Flags.
  • Choose c/c++ build–>Settings->GCC C Linker->Libraries and include the pthread library into the other libraries.
  • Click Apply and rebuild the project. Pthreads should work now.

How do I enable Python support in Eclipse Galileo (v3.5)?

To support editing of Python script in Eclipse Galileo (v3.5), please follow the steps enlisted below.

  • It is assumed that Eclipse Galileo (v3.5) is pre-installed.
  • If not, please visit http://www.eclipse.org/, download Eclipse Galileo based on the host operating system installed on your system and install it.
  • Open Eclipse, select ‘Help’ menu on the menu bar followed by ‘Install New Software’ sub-option.
  • Key-in the URL – ‘http://pydev.sourceforge.net/updates/’ in the text box is placed towards the right side of the label ‘Work with:’ as shown in the image below.

  • Check the checkbox against the name, ‘PyDev for Eclipse’ and click Next.
  • That will install Python support in Eclipse.
  • It may ask you to restart Eclipse, in such a scenario, please follow the instructions displayed on the screen.
  • After restarting Eclipse, open any file with ‘.py’ extension and the file should be color coded in Eclipse editor. If not, try changing the perspective to ‘Python’ or ‘PyDev’ perspective depending on which ever available. That should solve the issue.

Resources:

Eclipse download site: http://www.eclipse.org/downloads/

John Paulett Blog: http://johnpaulett.com/2009/06/26/install-eclipse-galileo-3-5-on-ubuntu-jaunty-9-04/

Python Development Environemnt: http://pydev.sourceforge.net/

Disclaimer:

All data and information provided on this site is for informational purposes only. sks8.wordpress.com nor skumar.co.nr makes no representations as to accuracy, completeness, currentness, suitability, or validity of any information on this site and will not be liable for any errors, omissions, or delays in this information or any losses, injuries, or damages arising from its display or use. All information is provided on an as-is basis. The trademarks, if at all used on this blog belong to their respective owners.