Subj : Re: Compile and Link To : borland.public.cpp.borlandcpp From : Magix Date : Tue Oct 05 2004 10:43 am "Ed Mulroy [TeamB]" wrote in message news:41616413@newsgroups.borland.com... > Your message is confusing as you describe your situation with C source > files yet ask for an example using C++ source files. Files with the > extension .C will be taken as C language and those with .CPP will be > taken as C++. > > You also say you have some libraries yet in your request for an > example you show names of LIB1.CPP and LIB2.CPP. Libraries have the > extension .LIB, not .CPP. > > I will use SOURCE2.C instead of SOURCE2.CPP and both LIB1.LIB and > LIB2.LIB in the example. I will also assume that you need to create > LIB1.LIB yourself and that it is created from LA.C and LB.CPP. > > The documentation, help that came with the compiler and the help > screen that shows when you run the compiler or linker with no command > line arguments show the various command line syntax and options. You > should read them. > > Makefiles are sensitive to which lines are indented vs starting in > column 1. A # character starts a comment. If you store the text > shown between the dashed lines below in a file named makefile or > makefile.mak then the command MAKE will run it. > > ---------------------------------- > # tell make.exe to handle dependencies on header > # files itself > .autodepend > > # macro to list all the object files needed > # the backslash is a line continuation character > > OBJS=source1.obj source2.obj source3.obj > > > # our target to build is source1.exe and it depends > # upon the list of files in the macro OBJS > > abc.exe : $(OBJS) lib1.lib lib2.lib > tlink /x/v/Tde/c c0l $(OBJS),abc,,lib1 lib2 emu cl > > # c0l.obj ('0' not 'o') startup code > # abc base name for the exe that will be created > # /x no map file > # /v debug info > # /Tde DOS exe > # /c case sensitive > # emu.lib floating point emulation > # cl.lib ('L' not '1') runtime library > > > # lib1.lib is a target. This would be meaningless because > # the first is the only target except that lib1.lib is listed as > # one of the items source1.exe depends upon so the first > # target's dependency causes it to be examined. > > lib1.lib : la.obj lb.obj > tlib /C lib1.lib -+la.obj -+lb.obj > > # the syntax above replaces the old object files > # so the first time you run this there are none to > # replace and the librarian will warn you of that > > > # how to build a *.obj file from a *.cpp one > # the $< is a macro which expands to the > # *.cpp file name > .cpp.obj : > bcc -c -ml -v $< > > # how to build a *.obj file from a *.c one > .c.obj : > bcc -c -ml -v $< > ---------------------------------- > > For more information on the command line options for the compiler, > bcc.exe, the linker, tlink.exe, and the librarian, tlib.exe, consult > the compiler's help or run them with no command line options to > receive a help screen. > > . Ed > > > Magix wrote in message > > news:4160fcb5$1@newsgroups.borland.com... > > > > I'm new to Borland Dos Compiler, > > > > I want to ask about Compiling into Object file and Link to > > create EXE file. If I have several C source files, and some > > own library files, what detail command option should I use > > to compile and link to create an EXE file, namely abc.exe. > > > > let say, source1.cpp, source2.cpp, source3.cpp, lib1.cpp, > > lib2.cpp > > Examples will be great. > > > > please advise. > > okie. Thanks for the info. if in my main.c contains #include "iolib.h", and this iolib.h is stored in a subfolder called inc. How can I make the compiler search for this "inc" folder, besides specifying #include "inc/iolib.h" in main.c? I always got this message: Error E2209 main.c 10: Unable to open include file 'iolib.h' The directory structure: main.c - iolib.h - iolib.c .