Discussion:
Trouble compiling C++ Builder code with bcc32
(too old to reply)
Dan D'Alimonte
2007-08-09 18:01:17 UTC
Permalink
Hi.

I'm new to Borland and need some help with the commandline tools.

I'm working with code written in C++ Builder and attempting to compile it using the commandline tools so it can be added to an automated compile/test system. Code that is compiling in C++ Builder just fine will not compile with bcc32 though.

The following files were written in C++ Builder:
- main.cpp, which contains the main() method.
- INIFile.cpp/.h, A simple class for representing an INI file.
- INIParser.cpp/.h, A class that uses the VCL TIniFile class to parse an INI file.

The files were copied out of the C++ Builder project directory and a Makefile was written for them as follows:

- Makefile: ----
BDS=C:\Program Files\Borland\BDS\4.0

CC=bcc32
INCLUDES=-I"${BDS}\include";"${BDS}\include\vcl"
LIBPATH=-L"${BDS}\lib";"${BDS}\lib\release"
CFLAGS=-WC ${INCLUDES} ${LIBPATH}
LIBS=

OBJS = main.obj INIFile.obj INIParser.obj

main.exe : ${OBJS}
${CC} ${CFLAGS} ${OBJS} ${LIBS}

clean :
@DEL /Q *.exe
@DEL /Q *.tds
@DEL /Q *.obj

.cpp.obj :
@${CC} -c $&.cpp
----

Now, when I run 'make main.exe' I get a bunch of link errors that I cannot figure out:

- Errors: ----
MAKE Version 5.2 Copyright (c) 1987, 2000 Borland
Borland C++ 5.81 for Win32 Copyright (c) 1993, 2005 Borland
main.cpp:
Borland C++ 5.81 for Win32 Copyright (c) 1993, 2005 Borland
INIFile.cpp:
Borland C++ 5.81 for Win32 Copyright (c) 1993, 2005 Borland
INIParser.cpp:
bcc32 -WC -I"C:\Program Files\Borland\BDS\4.0\include";"C:\Program Files\Borland\BDS\4.0\include\vcl" -L"C:\Program Files\Borland\BDS\4.0\lib";"C:\Program Files\Borland\BDS\4.0\lib\release" main.obj INIFile.obj INIParser.obj
Borland C++ 5.81 for Win32 Copyright (c) 1993, 2005 Borland
Turbo Incremental Link 5.69 Copyright (c) 1997-2005 Borland
Error: Unresolved external 'System::__linkproc__ __fastcall LStrClr(void *)' referenced from C:\PROGRAM FILES\BORLAND\BDS\4.0\LIB\RELEASE\VCLE.LIB|dstring
Error: Unresolved external 'System::__linkproc__ __fastcall LStrFromPChar(System::AnsiString&, char *)' referenced from C:\PROGRAM FILES\BORLAND\BDS\4.0\LIB\RELEASE\VCLE.LIB|dstring
Error: Unresolved external 'Inifiles::TIniFile::' referenced from C:\DOCUMENTS AND SETTINGS\DAN\MY DOCUMENTS\SRC\IWTS\TRUNK\SRC\INIPARSER.OBJ
Error: Unresolved external '__fastcall Inifiles::TIniFile::~TIniFile()' referenced from C:\DOCUMENTS AND SETTINGS\DAN\MY DOCUMENTS\SRC\IWTS\TRUNK\SRC\INIPARSER.OBJ
Error: Unresolved external '__fastcall System::TObject::~TObject()' referenced from C:\DOCUMENTS AND SETTINGS\DAN\MY DOCUMENTS\SRC\IWTS\TRUNK\SRC\INIPARSER.OBJ
Error: Unresolved external 'System::__linkproc__ __fastcall LStrAsg(void *, const void *)' referenced from C:\PROGRAM FILES\BORLAND\BDS\4.0\LIB\RELEASE\VCLE.LIB|dstring
Error: Unresolved external '__fastcall Inifiles::TCustomIniFile::TCustomIniFile(const System::AnsiString)' referenced from C:\DOCUMENTS AND SETTINGS\DAN\MY DOCUMENTS\SRC\IWTS\TRUNK\SRC\INIPARSER.OBJ

** error 1 ** deleting main.exe
----

I am new to both C++ development and to using Borland tools and libraries, so any help people may be able to offer would be much appreciated.

Thanks.
Craig Farrell
2007-08-09 18:38:08 UTC
Permalink
Hi again,
-WCV is the switch for Windows Consolge VCL compile.
I should have phrased that "Windows Console VCL Target"
which makes it clearer that the switch is invoking the
linker with the correct obj's and lib's for a console
VCL target. For example, if you view the linker command
line in the IDE, you see sysinit.obj and vcl.lib, and
rtl.lib etc. The compiler target switches pass those
for you when the linker is invoked.

--Craig
Dan D'Alimonte
2007-08-09 19:11:07 UTC
Permalink
Thank you. Using the -WCV flag worked and the code now compiles just fine
Craig Farrell
2007-08-09 18:32:46 UTC
Permalink
Hi,
Post by Dan D'Alimonte
CFLAGS=-WC ${INCLUDES} ${LIBPATH}
-WCV is the switch for Windows Consolge VCL compile.
BTW, the command...
bcc32.exe -h -W
...should show WCV and it is a bug that it does not.
In general, I recommend turning ON the IDE switch
in Environment Options for "Show Command Line" alhthough
it would not have helped you in this case because the
IDE uses separate compiler and linker lines.

--Craig
Loading...