Creation of the Eclipse project and building in the Eclipse
In the Eclipse create new project of type: Makefile Project with Existing Code and enter the project directory.
Next, set up build parameters according to following screenshots:
set the definition of __fastcall symbol:
and include paths:
You need to fix the IDE generated hello1.cpp file, just add return type (int) for WinMain function:
//---------------------------------------------------------------------------
#include
#pragma hdrstop
//---------------------------------------------------------------------------
USEFORM("Unit1.cpp", Form1);
//---------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE, HINSTANCE , LPSTR , int )
{
try
{
Application->Initialize();
...
When you execute [Build Project] in the Console window (CDT Build Console) you will see building messages:
15:33:13 **** Incremental Build of configuration Default for project hello1 ****
"c:\Progra~1\borland\cbuilder6\bin\make" -f hello1.mak hello1.exe
MAKE Version 5.2 Copyright (c) 1987, 2000 Borland
c:\Progra~1\borland\CBUILD~1\bin\..\BIN\bcc32 -Od -H=c:\Progra~1\borland\CBUILD~1\bin\..
\lib\vcl60.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi- -c -tW -tWM -w-par -I"C:\Program File
s\Borland\CBuilder6\Projects";C:\_Projekty\builder2eclipse;c:\Progra~1\borland\CBUILD~1\bin\..\i
nclude;c:\Progra~1\borland\CBUILD~1\bin\..\include\vcl -D_DEBUG;_RTLDLL;NO_STRICT;USEPACKAGES -n
.\ .\hello1.cpp .\Unit1.cpp
Borland C++ 5.6 for Win32 Copyright (c) 1993, 2002 Borland
.\hello1.cpp:
Loaded pre-compiled headers.
.\Unit1.cpp:
Loaded cached pre-compiled headers.
c:\Progra~1\borland\CBUILD~1\bin\..\BIN\ilink32 @MAKE0000.@@@
Turbo Incremental Link 5.60 Copyright (c) 1997-2002 Borland
15:33:14 Build Finished (took 910ms)
As the result hello1.exe executable file is created. Unfortunatelly, there is still missing clean option for intermediate and final files.
You need to add in the project makefile (i.e. hello1.mak) following rules:
...
.rc.res:
$(BCB)\BIN\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $<
# ---------------------------------------------------------------------------
clean:
rm -f $(PROJECT)
rm -f $(OBJFILES)
rm -f $(PROJECT:.exe=.tds)
all: $(PROJECT)
and enable calling all and clean targets in the IDE:
Error and Warning detection by the Eclipse
The Borland C++ Builder generates warnings and errors in different format than the Eclipse expects:
Borland format
Error E2141 .\Unit1.cpp 21: Declaration syntax error in function _fastcall TForm1::Button1Click(TObject *)
GNU format (recognised by the Eclipse)
ListaKont.cpp:1066:1: warning: W8008 Condition is always true in function Wypelnianie()
The format can be transformed by the script in AWK (scripts/build_msg_transf.awk) and the script can be inserted in building operation pipe.
It is convenient to put it all in a script that set up proper paths. In this way building is set up in the Eclipse by providing a name of the script (build.bat):
Let's make intentionally an error, e.g. by deleting semicolon at the end of line in Umain1.cpp. This cause compilation error and the message is recognized by the Eclipse.
You can try this by opening Problems window (see below), clicking on a list on the error. It should move focus to the source file where the error has been detected.
More advanced modification of building process can be found in the description: How to build Borland C++ Buildera project in Eclipse (using GNU make).
Links
- The MinGW project site - download and install MinGW i MSYS
- The Eclipse project site - download and install the Eclipse IDE for C/C++ Developers
- Source files - examplar project for Borland C++ Builder in the Eclipse
- List of errors in Borland C++ Builder