Board index » cppbuilder » compile and linking C++ and pas obj files

compile and linking C++ and pas obj files


2005-04-28 04:33:47 AM
cppbuilder91
hi,
how can i compile a c++ obj file and a pascal obj file with the command
line compilers and how can i link the obj files to a Exe file.
thanks
wulfrich
 
 

Re:compile and linking C++ and pas obj files

You have not mentioned what version of C++ Builder you are using.
Here I assume that you have version 6.
In your project's directory there should be a project file with a name
like ProjName.BPR
Create a make file with this command:
bpr2mak ProjName.BPR
You can then build the project with this command
make -f ProjName.MAK
(the space after the -f and the extension .MAK are optional)
If you do not want to use the project file to do this then try this:
Create a directory.
Place all the files for the project into that directory.
Make that directory the default.
Put what is between the dashed lines below into a file named makefile.
------------------------------
.autodepend
TARGET=ProgramName
OBJS=file1.obj file2.obj file3.obj
RESFILE=
$(TARGET).exe : $(OBJS)
ilink32 @&&|
/D"" /aa/Tpe/GD/x/Gn/v +
c0w32 $(OBJS) sysinit, $(TARGET),, +
memmgr vclx vcl rtl import32 cp32mti,$(RESFILE)
|
COPTS1=-Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi- -c
COPTS2=-tW -tWM -w-par -w-8027 -w-8026
COPTS3=-D;_RTLDLL;NO_STRICT
.cpp.obj |
bcc32 @&&|
-H=".\$(TARGET).csm" $(COPTS1) $(COPTS2) $(COPTS3) $<
|
.pas.obj :
dcc32 @&&|
-$YD -$W -$O- -$A8 -v -JPHNE -M -D;_RTLDLL;NO_STRICT $<
|
------------------------------
Edit makefile
- Substitute the desired base name of the executable
for the 'ProgramName' in the TARGET= statement
- Substitute a list of the object files for the items
following the equal sign in OBJS=
- If a compiled resource file (a *.res file) is used then
add the file name after the equal sign in RESFILE=
Give this command to create an executable
make
. Ed
Quote
Wulfrich Schmueckle wrote in message
news:426ff6e5$ XXXX@XXXXX.COM ...

how can i compile a c++ obj file and a pascal obj file with the
command line compilers and how can i link the obj files to a Exe
file.
 

Re:compile and linking C++ and pas obj files

There is an error in what I posted.
This line is not correct:
memmgr vclx vcl rtl import32 cp32mti,$(RESFILE)
It should be:
memmgr vclx vcl rtl import32 cp32mti,,$(RESFILE)
The change is the one comma before $(RESFILE) is now two commas.
. Ed
Quote
Ed Mulroy wrote in message
news:42700bce$ XXXX@XXXXX.COM ...

You have not mentioned what version of C++ Builder you are using.
Here I assume that you have version 6.

In your project's directory there should be a project file with a
name like ProjName.BPR

Create a make file with this command:

bpr2mak ProjName.BPR

You can then build the project with this command

make -f ProjName.MAK
(the space after the -f and the extension .MAK are optional)


If you do not want to use the project file to do this then try this:

Create a directory.
Place all the files for the project into that directory.
Make that directory the default.

Put what is between the dashed lines below into a file named
makefile.

------------------------------
.autodepend

TARGET=ProgramName
OBJS=file1.obj file2.obj file3.obj
RESFILE=

$(TARGET).exe : $(OBJS)
ilink32 @&&|
/D"" /aa/Tpe/GD/x/Gn/v +
c0w32 $(OBJS) sysinit, $(TARGET),, +
memmgr vclx vcl rtl import32 cp32mti,$(RESFILE)
|

COPTS1=-Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi- -c
COPTS2=-tW -tWM -w-par -w-8027 -w-8026
COPTS3=-D;_RTLDLL;NO_STRICT

.cpp.obj |
bcc32 @&&|
-H=".\$(TARGET).csm" $(COPTS1) $(COPTS2) $(COPTS3) $<
|

.pas.obj :
dcc32 @&&|
-$YD -$W -$O- -$A8 -v -JPHNE -M -D;_RTLDLL;NO_STRICT $<
|
------------------------------

Edit makefile
- Substitute the desired base name of the executable
for the 'ProgramName' in the TARGET= statement
- Substitute a list of the object files for the items
following the equal sign in OBJS=
- If a compiled resource file (a *.res file) is used then
add the file name after the equal sign in RESFILE=

Give this command to create an executable

make
 

{smallsort}