Wednesday, June 24, 2009

ECLIPSE ON CYGWIN


I've jotted down the steps. I hope it facilitates when you are putting the code in Eclipse environment.

Assumptions:
1. Install Eclipse, and

2. Install CYGWIN
3. Ensure CYGWIN is installed, and make/gcc/g++ run in the cygwin env(or when cygwin execsutables are in the PATH env)
To test if cygwin was installed correctly open a command prompt and type g++ or make.
The following error message means that no make is installed or your path is not configured correctly.
'g++' (or 'make') is not recognized as an internal or external command, operable program or batch file
To check your path open a command prompt and type PATH. Make sure that the path to your build utility is defined (example PATH=c:\cygwin\bin).


Steps to build/debug:
1. Window->Preferences->Debug->Common Source Lookup Path-> Path Mapping : New Mapping
(Compilation path : \cygdrive\c\ pointing to Local file system path: c:\)

2. "Managed Make C++ Project" - Wizard creates it for you
"Standard Make C++ Project" - you are using your own makefile.

3. Create a new project
File -> New -> Managed Make C++ Project :
- Project Name : MyProject
(Only .h, .hh and .cc files from MyProject are in this folder. Note: Makefile is created by Eclipse)
- Click Finish.

4. The project builds automatically, as Project->Build Automatically is checked.
If it is unchecked, build the project by :
(i) Right click on the project - Build
or (ii)Project->Build Project

5. If you get errors like
- derror.h: No such file or directory MyProj wait.hh line 5 1190176735947 5321
do the following:
(i) Project->Properties->C/C++ Build->GCC C++ Compiler->Directories
(ii) Click on the Add->Workspace…
(iii) Choose the workspace WS2

6. Before you start debugging ensure that the debugging settings are made.
Run-> Debug… -> C/C++ Attach to Local Application
Double click on C/C++ Attach to Local Application
or
Run-> Debug… -> C/C++ Local Application
Double click on C/C++ Local Application
Select the project : WS2
Click on Search Project…
Select the binary (WS2.exe)

Happy debugging!

No comments:

Followers

Blog Archive