сделать стартовой  |  добавить в избранное

   SciTE - редактор кода для программистов

Подключение компилятора Borland C++ 5.5

Автор: Тугаринов Сергей / Дата: 09.01.2006 / Комментариев: 31
Категория: Компиляторы

What is Borland C++ 5.5?

Inprise Corporation, [also known as Borland],the makers of Delphi, Turbo Pascal, and C++ Builder, will let you freelydownload and use their C++ 5.5 compiler. This is Borland's latest ANSI/ISOC++ compiler, the same compiler that is used in C++ Builder 5.

BCC55 comes with everything you need to compile and link both console-modeand GUI programs that will run on Windows 95/98/NT/2K. Your programs willnot run on Windows 3.1 or DOS machines however.

BCC55 does not come with an Integrated Development Environment [IDE].Instead, you write your source code using a text editor, such as WindowsNotepad or SciTE. You then compile, link, and run your programs from thecommand-line. [That is, a DOS Window.] Borland also provides the text-modeTurbo Debugger as a separate [free] download.

The rest of this page will walk you through the steps necessary to download,install, and run your C++ programs using Borland C++ 5.5. You'll also learnhow to configure the SciTE programmer's editor to compile and run yourprograms without returning to the command line.

Downloading and Installing BorlandC++ 5.5

You can download the necessary files from home over the Internet. If youhave a slow connection at home [a modem] you can download all of the filesbelow from the OCC Computing Center local area network.Because of the size of the files, you'll need to use a ZIPdisk to save the program if you download it in the Computing Center.


You can download the compiler, linker and basic command-line tools fromthis link. The latest version [August 24, 2000] is 5.5.1. You'll have toregister, but registration is free:
The compiler program is about 9MB.

Other Downloads

A good source of information about the Borland command-line tools can befound on Helmut Pharo's site in Germany. (Note: the site has been downfor some time, so the link below is to an unofficial mirror.)
Borland also offers some other downloads you might be interested in. Manyof them have very little to do with the command-line tools, and are quitelarge. Here are some you might want someday:

You can download the TurboDebugger from this link. As with the compiler,you'll have to register, but registration is free:

You can download the Standard C++ Builder Help file from this address:
Much of this large [7.75 MB] file contains material unrelated to the command-linetools, but you might find the C++ language and Standard C++ Library referenceuseful.

You can download a set of FAQs [Frequently Asked Questions] from thislink. As with the documentation bundle, the majority of the material isnot relevant to the command-line compiler.


Installing and Configuring theTools

Once you have downloaded the compiler, youwill need to install and configure it. Fortunately, this is fairly easyif you follow these directions.

Step 1: Install the Tools

The procedures that follow assume that you will install the command-linetools in a directory named C:\BCC55. If you want to install somewhere else,simply change the path when following these instructions. 

A. Use WindowsExplorer to find the file you just downloaded.

This is a self-extracting file, so you won't need WinZip to installthe tools. Simply double-click the file.

Finding FreeCompiler.exe using Windows Explorer.

B. Double-clickthe file FreeCommandLineTools.exe. This will launch the InstallShield installationprogram. When the first screen pops up, just click Next...
The BCC 5.5 Welcome dialog.

C. The next screen is the license screen.Read through the license and then click "I Agree".
The BCC 5.5 license screen.

D. The next screen asks you to enter thename for the Installation Folder. There's nothing really wroing with thedefault [C:\Borland\BCC55], but I've shortened it to C:\BCC55 as previouslymentioned.
Selecting a folder to install the compiler.

E.Unless you are reinstalling, the folder you specified will not exist. AnswerYes when asked if you want to create it.
The create folder confirmation dialog.

F. Once you click OK, the installationprogram will uncompress each of the files and place them in the directoryyou specified. As it works, it will keep you updated with a progress dialoglike this.
The compiler unpacking progress dialog.

G.Once it has uncompressed all of the files, the installer will notify youlike this.

Click OK and your done.

The compiler completion dialog.

Step 2: Configure the Tools

Before you can use the compiler you need to configure the tools for yourmachine. This process requires you to tell the operating system [Windows]where the executable files are, and to tell the compiler where the includeand library files are located. You'll also need to tell the compiler ifyou want to pass any special switches.

To configure the tools we'll write one batch [BAT] file and two CFGfiles. [This assumes you are using Windows 95/98. If you are using NT,W2K, or XP, you can write a CMD file instead of a BAT file, but a BAT filewill work as well.] 

An Alternative to Creating StartBC.bat
Strictly speaking, you don't need the batch file at all, if you wantto modify your system environmental variables. To do this in Windows 95/98/ME,modify the file C:\AUTOEXEC.BAT, and add the lines shown in Step3A below. 

In Windows NT/2000/XP, you modify the path settings using the SystemProperties dialog, which you open from the Control Panel. Select theAdvanced page on the dialog, and then click the EnvironmentalVariables button at the bottom of the page : 

The Advanced Systems Properties page.
On the Environmental Variables page, locate the Path variablein the System Variables section, and click the Edit buttonlike this: 
Editing the Path Environmental variable.
Add a semicolon to the end of the existing path, and follow the semicolonwith the path to the C:\BCC55\bin directory.

 We'll start by writing the batch file to configure the environment:

A. StartBC.bat

1. Open Notepadfrom the Start Menu. It's located under Accessories.
Launching Notepad from the Accessories menu.

2. Before youmake any changes, save the empty file as StartBC.bat in the C:\BCC55directory. If you are running Windows NT or W2K, save the file as StartBC.cmdinstead.

Be sure you put quotes around the file name when you save it, or elseNotepad will save your file as StartBC.bat.txt.

Changing the name of your batch file in Notepad.

3. Add thefollowing two lines to your batch file, and then save it again.
The contents of the StartBCC.bat batch file.

B. bcc32.cfg

1. While youstill have Notepad open, select New from the File menu. Thiscreates a new blank document in Notepad.
Creating a new file in Notepad.

2. Beforeyou make any changes, save the empty file as bcc32.cfg in the C:\BCC55\BINdirectory. Note that this is not the same directory whereyou saved StartBC.bat.

Be sure you put quotes around the file name when you save it,or else Notepad will save your file as bcc32.cfg.txt, which won'twork at all.

Locating the BCC55 bin directory when saving your file.

3. Add thefollowing lines to your file, and then save it again. Note, however, thatif you've installed the compiler in a directory other than C:\BC55\BIN,you'll need to adjust the lines so that they reflect the actual locationof the compiler's include and library files.
The contents of the bcc32.cfg file in Notepad.
If you're interested, here's what each of these lines means:
  • -I : tells the compiler where to look for system include files
  • -L : tells the compiler where to look for libraries
  • -P : tells the compiler to compile using C++, even if the source ends with.c
  • -v-: tells the compiler to turn off debugging.
  • -w : tells the compiler to issue warnings
  • -D : defines several constants so your executables will work with W95/98/NT
Note that the I, L, P, and D are uppercase, while the v and w are lowercase.This is important, because if you use an uppercase W, you generate a Windowsapplication instead of warnings.

C. ilink32.cfg

1. While youstill have Notepad open, select New from the File menu.
Starting a new file in Notepad.

2. Beforeyou make any changes, save the empty file as ilink32.cfg in theC:\BCC55\BINdirectory. Note that this is not the same directory whereyou saved StartBC.bat.

Be sure you put quotes around the file name when you save it,or else Notepad will save your file as ilink32.cfg.txt.

Locating the BCC55 bin directory using Windows Explorer.

3. Add thefollowing lines to your file, and then save it again. Note, however, thatif you've installed the compiler in a directory other than C:\BC55\BIN,you'll need to adjust the lines so that they reflect the actual locationof the compiler's include and library files.
Contents of the ilink32.cfg file.
If you're interested, here's what each of these lines means:
  • -L : tells the linker where to look for libraries
  • -v-: tells the linker to turn off debugging.
  • -x : tells the linker not to generate a map file.

Step 3: Create a Shortcut

You should create a shortcut on the desktopto run the compiler. Here's are the instructions for Windows 95/98: 

A. Find anempty space on the desktop and right-click. Choose New>Shortcutfrom the context menu that appears.
Creating a shortcut in Windows 98.

B. For Windows95/98, type the word command when asked which program to run. Thenclick Next.
Completing page one of the Create Shortcut dialog.
For Windows NT, XP, or 200 [shown here], type the word cmd instead likethis:
Creating page 1 of the Create Shortcut dialog in Windows 2000.

C. Type in a name for the shortcut, andclick Finish:
Selecting a title for the shortcut [Create Shortcut dialog page 2].

D. Right-clickthe shortcut on the desktop and choose Properties from the contextmenu.
Opening the shortcut Properties dialog.

E. For Windows 95/98, when the shortcut properties dialog appears, switchto the Programs tab and change the following two entries:
  • Set the Working directory to the name of the directory where youwant to store your source-code [C++] files. I have a directory called MyFiles.[Make sure that this directory exists.]
  • Set the Batch File entry to C:\BCC55\StartBC.bat. This isthe same file that you created earlier.
Once you're finished, click the "Change Icon" button.
Completing the W98 shortcut dialog and clicking Change Icon.
For Windows NT/2000/XP, you'll see that the Shortcut dialog doesnot have a text-area where you can enter a batch file. Instead, of placeingC:\BCC55\StartBC.cmd in the Batch File text-area, place it inthe Target text-area, following the text that already exists. Then, typea slash-k ( /k ) between the existing text and the batch file.

Here's an example using Windows XP. The Dialog for NT and 2K is similar. 

Completing the W2K Shortcut Properties dialog and pressing Change Icon.

F.When the Change Icon dialog appears, click the Browse button andlook for the file named MORICONS.DLL . In Windows 95/98/ME you'llfind it in the Windows directory; in NT/2K/XP, it should be in the Windows\System32directory. Once you open the file select the Borland C++ icon from thelist. [This isn't necessary, of course. You can use any icon you like.]

Once you're finished, click the "OK" button. Close the Propertiesdialog as well.

Choosing an Icon for your shortcut.

Checking Your Installation

Once you've installed BCC, simply double-clickthe icon on your desktop to initialize the compiler. You should see somethingthat looks like this. You'll see a different set of directories in yourPATHstatement than shown here, but it should start with C:\BC55\BIN;If, instead, you get an error message, double-check each of the previoussteps.
Starting your compiler by double-clicking the shortcut.

2. Check the Paths

Next, you'll want to make sure that the compiler is actually working. Todo that, you'll run the compiler and pass it the "Help" switch. At theprompt, simply type:
and press Enter. You should see a list of compiler options likethis:
Borland command-line options at the command-line.
If you don't, then check the first line in your batch file and make sureit points to your compiler's BIN directory.

3. Create the Source

From the command-line, type:
Notepad bcc1.cpp
and press ENTER. This will launch the Notepad program usingthe filename bcc1.cpp. [When Notepad asks you if you wantto create the file, answer "Yes".] Type in and save the following program,being very careful with spelling and punctuation:
Creating a Hello World program in Notepad.

3. Compile and Link

Once you've saved your file, return to the command-line, and type:
bcc32 bcc1.cpp
and press ENTER. This will launch the compiler and the linker. Ifyou haven't made any mistakes, this is what you'll see:
Compiling and linking your program from the command-line.
The compiler and linker produce several different files. If you use theDIR command, you should see something like this:
A listing of files created when compiling from the command-line.
The large file with the extension .TDS consists of Turbo DebuggerSymbols. Even though we turned debugging off, the linker still createsa dummy file. With debugging on, however, the file is much larger. Youcan safely delete this file if you like.

The file with the extension .OBJ is the compiled machine codebefore linking. After combining library code and startup code, the .OBJfile becomes an .EXE.

4. Dynamic Linking

You can make your code considerably smaller by using dynamic linkinginstead of static linking. Dynamic linking simply means that yourprogram loads code from a runtime DLL instead of linking commoncode into the EXE file. To enable dynamic linking, add the -tWCRswitch when you compile like this:
bcc32 -tWCR bcc1.cpp
As you can see from this picture, the sizes of all the files are much smaller.The executable program will only run on a machine that has the BorlandC Runtime Library DLL installed, however. 
Using Borland's dynamic linking option.

5. Running your Program

To run your progam, simply type it's name at the prompt, and press ENTER.You don't have to add the .EXE extension.
Running your program from the command-line.

Using the SciTE Editor withBCC

SciTE stands for the Scintilla Text Editor.It is a small, free programmers editor you can use to edit and compileyour C++ programs. Using SciTE is better than using Notepad, because:
  • SciTE "understands" C++, and color-codes your text while you type
  • SciTE let's you compile your programs from inside the editor
  • SciTE highlights syntax errors, and places you on the offending line
Once you have configured BCC, download the files Sc1.exe[about 200K] and the configuration file SciTEGlobal.properties,and place them both in your C:\BCC55\BIN directory. Then, add thefollowing line to the bottom of your StartBC.bat file:
Now, when you double-click your BCC shortcut, it will launch both the commandwindow, which you can use as shown in the previous section, and the SciTEeditor. Let's try it out with the same steps we used previously:

1. Create the Source

Double-click the shortcut and make sure that both your command-line andthe SciTE editor start running. Then, open bcc1.cpp from the previoussection and make a little change to the output message. You should seesomething like this: 
Opening bcc1.cpp in SciTE.

2. Compile Your Code

To compile your code, Choose Tools->Compile from the menu, or PressCTRL+F7:
Compiling your code from inside SciTE.
This will save your file and launch the Borland compiler, just as if youhad typed bcc55 from the command line. You can see the compilationprogress at the bottom of the screen:
Compilation progress in SciTE.

3. Run Your Program

If your C++ program does not have any input [that is, you don't use cin,only cout], then you can run your program from within the IDE byselecting Tools->Go from the menu, or pressing F5. Your programwill run and the output will appear at the bottom of the editor like this:
Running bcc1.exe in SciTE.
If your program does require input from the user, then you must launchit using the command line window, as in the previous section.

4. Syntax Errors

If your program contains syntax errors, the error messages will appearat the bottom of the screen. To see how this works, edit bcc1.cpp,and replace the int in front of main() with the word ink.When you compile, you should see a message like this:
A syntax error in SciTE.
Note the error message which is outlined here in red. The error messagetells you what file caused the error [bcc1.cpp], what line the erroroccurred on [5], and a brief description of the error [Declarationsyntax error]. Even better, if you double-click the error message,SciTE will highlight the line of text containing the error likethis:
Going to an error in SciTE.
While it won't fix the error for you, it is much more useful than simplyusing Notepad. 

Materialson this web site © 1995-2002,  Orange Coast College. All rightsreserved.Any materials may be reproducedfor non-profit purposes

Версия для печати / Прочитано: 56169 раз(а)

Комментариев: 31 (rss)

1. mozers™ / 12.01.2006 - 10:19
Установленный пакет можно использовать и для компиляции SciTE.
Один маленький ньюанс:
Обязательно уберите рекомендуемый в этой статье ключ -P из файла bcc32.cfg иначе на этапе линковки посыплются ошибки
"Error: Unresolved external '_lua_..."

Альтернативное решение - использовать урезанный пакет.
2. Aibek / 30.10.2006 - 10:59
Спасибо Вам огромное за такую программу! А начал изучать Borland C++ 5.5, но интегрированной среды не нашел. По вашей инструкции все сделал и у меня компилятор заработал с вашей средой :) Только вот проблема, файл Sc1.exe и SciTEGlobal.properties от старой версии, а вот как использовать новую версию никак не врублюсь. Может подскажете?
И второе, при нажатии F1 помощь не выходит, как ее добавить?
3. Тугаринов Сергей / 30.10.2006 - 12:07
Вы можете скачать новую версию сборки размещенной на сайте.
Если вы исправляли какие-либо настройки размещенные в SciTEGlobal.properties перенесите их в SciTEUser.properties.

Так же не забудьте перенести настройки CPP на новую версию редактора.

По идее перечисленного достаточно для комфортной работы со связкой Borland со SciTE.
4. Aibek / 30.10.2006 - 14:40
В том то и дело что я вначале скачал новую версию, не смог с ней разобраться и, опять перешел к старой Вашей вышеописанной версии...
У меня выявляется следующего рода ошибка:
>g++ -pedantic -Os -c f1.cpp -o f1.o
>The system cannot find the file specified.

Вопрос: В новой версии где можно указать на исполнимый файл компилятора bcc32? Ведь сюда по ошибке она обращается к другому компилятору...
5. Тугаринов Сергей / 03.11.2006 - 18:18
Извините, совсем забыл про этот пост :)

В общем вам необходимо подправить файл cpp.properies, там и хранятсья настройки компилятора.

6. Andrey / 18.11.2006 - 21:31
(Заранее прошу прощения у великих гуру, я только-только поставил себе SciTE и еще не все истыкал :) )

Вот такой вопрос.... а если мне нужно использовать какой-нибудь другой компилятор?
Еще, как сделать так, чтобы программа запускалась не в окне консоли, а в своем собственном?
И еще, как вызываемой программе передать параметры (аргументы) командной строки?
7. Andrey / 19.11.2006 - 19:56
Все, разобрался :)
Если кому интересно, то вот что нужно сделать:

1) Изменить файл cpp_.properties (или другой):
command.go.$(file.patterns.cplusplus)=cmd /c start C:\\exec.bat $(FileName) $(1) $(2) $(3) $(4)

2) Создать на диске C файл exec.bat со следующим содержимым:
%1 %2 %3 %4 %5 %6 %7 %8 %9

После этого запускаемые вами программы будут отрабатывать свои действия в отдельном окне, а не в окне консоли SciTE.
(И никакого SC1.exe :))
8. Petruha / 28.01.2007 - 16:46
Три раза пытался выполнить все по инструкции. Нихрена не получилось. Может кто-нибудь поможет все в деталях расскажет об этом подключении. Заранее спасибо!
9. Тугаринов Сергей / 28.01.2007 - 22:37
Petruha, так как подписка на комментарии не работает, вам будет с этим вопросом лучше обратиться на форум
10. Dert / 18.05.2008 - 18:22
Спасибо, ОДУРЕННАЯ инструкция!! Я доволен просто неописуемо :) Давно хотел с этим всем разобраться да никак не удавалось... А тут! Свой ярлык! В работе сразу со своим значком! :))))

Спасибо, в общем, разобрался наконец! Я и так запускал через командную строку, догадавшись, но ессно хотелось узнать как максимально удобно, ведь некоторые вещи тут сам ника не придумаешь, надо только где глянуть.
11. DeAtHToUcH / 13.06.2008 - 10:47
Наткнулся сегодня на SciTE 1.76 .57Ru, прога очень понравилась. Решил подключить Borland'овский компилятор, но вариант с помещением Sc1.exe и SciTEGlobal.properties в директорию компилятора мне непонравилась.
Так как SciTE не хранит настройки в системе, решил сделать вариант для флешки используя относительные пути. Немного поковырялся и вот к чему пришёл:

В корне диска есть файл SciTE.bat и папка Programs, а в ней SciTE(сам редактор) и CPP(компилятор Borland C++ 5.5).

В файле SciTE.bat три строчки:
start .\Programs\SciTE\SciTE.exe

Пришлось модифицировать bcc32.cfg и ilink32.cfg, есть два варианта:
1Если использовать относительные пути то компиляция будет работать только у файлов находящихся в каталоге с SciTE.bat (в данном пимере в корне диска):
Содержимое bcc32.cfg - относительные пути:

Содержимое ilink32.cfg - относительные пути:

2Если относительными путями не пользоваться то компиляция работает для любых файлов:
Содержимое bcc32.cfg - прямые пути:

Содержимое ilink32.cfg - прямые пути:

Чтобы в SciTE работали команды выполнить и компилировать (насчёт собрать я не уверен) в файле cpp.properties изменить строку
cc=g++ $(ccopts) -c $(FileNameExt) -o $(FileName).o
cc=$(SciteDefaultHome)\..\CPP\BIN\bcc32 -v- -w -O1 $(FileNameExt)
и строку
command.go.needs.$(file.patterns.cplusplus)=g++ $(ccopts) $(FileNameExt) -o $(FileName)

Если ещё повозиться можно сделать и ярлык вместо батника (мне нужно портативно, поэтому оставил батник).
12. DeAtHToUcH / 13.06.2008 - 11:24
Извените за опечатку:
Содержимое bcc32.cfg - прямые пути:

вместо . надо C:
13. Psycho / 10.12.2008 - 14:21
Вариант для флешки с относительными путями (+ интегрирование в TotalCommander Podarok Edition).
Цель: Создать полностью переносимый редактор C\\CPP, встроенный в TotalCommander (PE).
Действия (пишу по памяти, могу ошибится (главное идея)):
1. Списываем SciTE в TotalCommander\\Programm\\SciTE, компилятор в TotalCommander\\Programm\\BCC
2. В cpp.properties ()
ccopts=-w- -jb -j1 -Hc -c -H=$(FileName).csm -L\"$(SciteDefaultHome)\\..\\BCC\\Lib\" -I\"$(SciteDefaultHome)\\..\\BCC\\Include\" -o$(FileName).o
cc=$(SciteDefaultHome)\\..\\BCC\\Bin\\bcc32.exe $(ccopts) $(FileNameExt)
ccc=$(SciteDefaultHome)\\..\\BCC\\Bin\\bcc32.exe $(ccopts) $(FileNameExt)

3. В папке TotalCommander\\Programm\\SciTE создаем 2 bat файла:
start SciTE.exe

и SciTE_F4.bat
SET PATH=%1\\..\\BCC\\Bin;%PATH%
start %1\\SciTE.exe %2

4. В тотале создаем на панели ярлык на SciTE.bat, а в настройках
Правки/Просмотра указываем: %commander_path%\\Programm\\SciTE\\SciTE_F4.bat %commander_path%\\Programm\\SciTE

Для сборки следует использовать makefile. Пример (для линкера ulink):

!include makeincl.inc

temp.exe \\
########################### Implicit Rules #######################
$(CPP) $(CPPFLAGS) -c {$? }

$(CPP32) $(CPPFLAGS) -c -Sr -Sd {$? }


CPP = bcc32
CPP32 = cpp32
LINKER = ulink

CCOPTS = -w- -jb -j1 -Hc -H=$(PCHROOT).csm -L\"$(MAKEDIR)\\..\\Lib\" -I\"$(MAKEDIR)\\..\\Include\"

#Compile flags:
LINKFLAGS= -Gn -Gi -ap -Tpe -x -L\"$(MAKEDIR)\\..\\Lib\"
LINKSTARTUP= c0x32.obj
LINKLIBS=import32.lib cw32$(LIBSUF).lib
14. Psycho / 10.12.2008 - 14:23
сорри - все слешы в предыдущем посте одинарные...
15. timus / 10.12.2008 - 19:51
Люди помогите!!!
вот такое выдает с первой прогой... Вопрос где я сделал ошибку? (windows у меня на диске D, а программа на диске С)
>bcc32 -v- -w -O1 bcc1.cpp
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
Error E2209 bcc1.cpp 2: Unable to open include file 'iostream'
Error E2282 bcc1.cpp 3: Namespace name expected
Error E2451 bcc1.cpp 7: Undefined symbol 'cout' in function main()
Error E2451 bcc1.cpp 7: Undefined symbol 'endl' in function main()
*** 4 errors in Compile ***
>Exit code: 1
16. Vlad / 18.05.2009 - 11:56
Люди помогите!!!
вот такое выдает с первой прогой... Вопрос где я сделал ошибку? (windows у меня на диске D, а программа на диске С)
>bcc32 -v- -w -O1 bcc1.cpp
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
Error E2209 bcc1.cpp 2: Unable to open include file 'iostream'
Error E2282 bcc1.cpp 3: Namespace name expected
Error E2451 bcc1.cpp 7: Undefined symbol 'cout' in function main()
Error E2451 bcc1.cpp 7: Undefined symbol 'endl' in function main()
*** 4 errors in Compile ***
>Exit code: 1

Тот же самый проблем... Что не так???

Добавить комментарий:

Интересные статьи / Тематические материалы © 2004 - 2017 - Хранение данных