🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

C++Builder Command Line Tools problem..

Started by
17 comments, last by fuzzyai 24 years, 3 months ago
I usually use VC++6.0 for win programming, but I just had to download the Borland C++ Builder Command Line Tools.. a top quality free compiler, who can resist? (in case you don''t know about it, check out http://www.borland.com/bcppbuilder/freecompiler/) perhaps i''ve been spoiled by IDEs (a far cry from good old Unix gcc and DJGPP that I first learned), but I''m having trouble compiling windows code with the command line tools. I''ve had anytime I try to do everything through the compiler (BCC32.EXE), it''s always looking for DOS code, and I get stuff about unresolved reference to _main and stuff.. if I compile and link seperately (ILINK32.EXE), I either get stuff about needing IMPORT32.LIB, or else it appears to link fine and when I try to run the newly built program (an extremely simple little dialog box) I get a page fault. I''ve been looking around various C++Builder community sites on the web, and posted there, but they''ve been little help because they all use the IDE. if anyone has any idea (or preferably an example of a command line syntax that works), it would be most appreciated. By the way, I''ve had absolutely no problems with DOS code. again, thanks ever so much.. Matt
Advertisement
I don''t use the command line tools for C++ Builder that often, so take this with a grain of salt.
I believe that your problem stems from the fact the BCC32 and ILINK and whatever other command line programs require a *lot* of command line options to get them to work how you think they should. The best way run the command lines tools is through a makefile. You can probably get a sample makefile from the borland site or maybe the compiler came with one or two. Then edit the sucker until it fits your project.
You may want to try the BCC32 option -Twe (type = windows exe). If that fails, then follow SiCrane''s advice, or read the help file that comes with the package (found in /help).

Good luck,

- genovov
i''ve tried the -Twe option with BCC32, and it gives me "FATAL: Expected option: IMPORT32.LIB", and still gives me that if I put IMPORT32.LIB after the .cpp file, but I put it before the .cpp, it appears to compile and link, and running it gives me a page fault..
I think SiCrane is right, I''ve just gotta use a makefile. I just got an IDE generated makefile from someone (though the line formatting is nonexistant cause it was posted to a rather poorly designed msg board, a pain to fix), so I should be able to get it working with alot of tweaking.
It''s not like it''s too terribly important anyway, seeing as I do own a copy of MSVC++6.0, and have had absolutely no problems with that...
thanks alot for your suggestions SiCrane and genovov, they''ve definitely been helpful..
(though genovov, I don''t know if you''ve seen what borland is giving out, but the help/documentation is about what you''d expect from a commercial venture giving something away for free: very little.. it gives you the basic syntax of the various tools, and an incomplete list of options..)
Yeah, I''ve seen the help file ;-). You can get a full list of options for the utilities by calling them without any parameters. Again this may not be much help...

- genovov
Here's a snipit from the makefile we use at Dynamix. We use OpusMake which I doubt anyone else uses but you should be able to read it.

Compile Flags:
Release Build: CFLAGS.GENERAL + CFLAGS.RELEASE
Debugging Build: CFLAGS.GENERAL + CFLAGS.DEBUG

Always link:
import32.lib cw32mt.lib
(note: cw32mt.lib is the multithreaded standard library)

Link Flags:
Release Build: LFLAGS.GENERAL + LFLAGS.RELEASE
Debugging Build: LFLAGS.GENERAL + LFLAGS.DEBUG

Notice in the %link: target that if we are bulding a console app (ie a dos box) then the add the -Tpe -ap flags and the c0x32.obj (startup code). For windowed apps -Tpe -aa and c0w32.obj (startup code).

Hope this helps. We've used borland at Dynamix for the last 8 years. Nice compiler. Recently we've switched to CodeWarrior because it's multi-platform (win32, Mac, Linux, etc, etc). And we've always used makefiles to build our projects, you can just do so much more in a makefile than the hand-holding IDE projects.

--Rick
Senior Software Engineer
Dynamix
(Currently working on Tribes2)

------------------------------------------------------
BORLAND ?= C:\BC5
TASM ?= C:\TASM

CC = bcc32.exe
CPP = bcc32.exe
ASM = $(TASM)\tasm32.exe
RC = brcc32.exe
LINK = ilink32.exe

#==============================================================================

CFLAGS.GENERAL =-c -5 -a1 -b -f- -ff -v -tWE -DBORLAND -DSTRICT -D__INTEL__ -DHAS_VSSCANF
CFLAGS.RELEASE =-x- -k- -pr -O2
CFLAGS.DEBUG =-x -k -pc -vi -Od -DDEBUG -DGATHER_METRICS=1 -DENABLE_ASSERTS -DPLATFORM_DEBUG

ASMFLAGS = /t /m /ml /z /zi /w-MCP /DBORLAND
LFLAGS.GENERAL =-c -w-dup -V4.0 -s -m -v -L"$(BORLAND)\Lib"
LFLAGS.RELEASE =
LFLAGS.DEBUG =-v

LIBS.GENERAL = import32.lib cw32mt.lib
LIBS.RELEASE =
LIBS.DEBUG =

#==============================================================================

%buildRES:
%foreach RESFILE in $(SRC)
@+$(RC) @<<
$(RCCFLAGS) -I$(.PATH.h);$(ARTdir);$(CCdir)\include;$(LIBdir)
-fo$(RESFILE,B,>.res, X)
$(RESFILE)
<< $(ErrFile)
%endfor

%buildASM:
@%set tasmINC=/i$[s," /i",$[t,;," ",$(INCdir)]]
%foreach ASMFILE in $(SRC)
%echo $(ASMFILE)
-:$(ASM) @<<
$(tasmINC) $(ASMFLAGS) $(ASMFILE), $[r,$(ASMFILE)].obj
<<
@mv $[r,$(ASMFILE)].obj $(OBJdest)
%endfor

%buildCC:
@+$(CPP) @<<
$(CFLAGS) -P -I$(.PATH.h) -n$(OBJdest) -c $(SRC)
<< $(ErrFile)

%buildC:
@+$(CPP) @<<
$(CFLAGS) -I$(.PATH.h) -n$(OBJdest) -c $(SRC)
<< $(ErrFile)

%link:
%if "$(BLDCONSOLE)" == "true"
@%set LINK_TYPE=-Tpe -ap c0x32.obj
%else
@%set LINK_TYPE=-Tpe -aa c0w32.obj
%endif
+$(LINK) @<<
$(LFLAGS) $(LINK_TYPE)+
$(.SOURCES, M"*.obj",W+\n)
$(OUT.FULL)\$(.target,F)
$(.target, B, <$(MAPdest)\\, >.map)
$(.SOURCES, M"*.lib") $(LIBS)
$(.SOURCES, M"*.def")
$(.SOURCES, M"*.res")
<< $(ErrFile)
@%set makesource=


Edited by - ricko on 2/27/00 12:15:42 PM
immeasurable thanks, RickO.. that''s much better than what I had to work with before.. i cannot say thanks enough...
If I don''t figure it out from that (and believe me, I''ll give it time and effort), I''ll just give up and only use MSVC++ for Win32 coding..
I have also had the same problem and it''s been driving me nuts. I''m a newbie and unfortunately I don''t have MSVC++, so I would appreciate if any of you can take me step by step on fixing up my problem. Please mail me at hal_lee@start.com.au .

Thanks in advance.
i haven''t gotten much of a chance to work on yet (had a big CS project due today), but i plan on devoting alot of time to working with the makefile the next few days.
when (if) i get it working, i''ll post it, or post a link to it. from the help RickO''s provided, i think i should be able to get it running without too much trouble.
Any news or updates on this matter?

This topic is closed to new replies.

Advertisement