Subj : Re: make confusion, help needed To : borland.public.cpp.borlandcpp From : "Ed Mulroy [TeamB]" Date : Tue Mar 16 2004 10:05 am The compile and link command lines have problems. The compile command line has redundant options and a serious problem of no memory model specified. - The compiler defaults to small model but with the BGI linked in small model is at best only barely able to fit that. Use large model, /ml or -ml on the command line for bcc.exe - The -I option duplicates what the compiler already supplies. - The -P- option tells the compiler to compile test3.c as a C file, which it already was told to do by the ".c" at the end of the file name. The link command line has no startup code, no runtime libraries and no output file name. It also does not mention the egavga.obj that you seem to want to link in. What it does have is a redundant -L option specifying a library path that duplicates that which it is already configured to use. The startup code for a DOS program is named c0?.obj (zero, not 'o') where the '?' is the first letter of the memory model. Neither BGI nor floating point can work with tiny model so for this one of S, M, C, L or H would be used. I suggest L for large model (avoid huge model unless you have very special needs). The runtime library for a DOS program is named c?.lib with the same naming convention for the '?'. A make file might look something like this: -------------------------------------- ..autodepend test3.exe : test3.obj tlink -c -Tde -x -v c0l test3 egavga,test3,,graphics cl test3.obj : test3.c bcc -c -v -ml test3.c -------------------------------------- The linker command line has several fields separated by commas. Because news readers wrap lines I'll show each on a separate line. This is the syntax for calling the linker: tlink {options} object files , output file name , map file name , libraries , module definition file name , resource file name The command line is stopped at the end of the last field used so for your DOS build you would just not put a comma after the libraries since neither of a module definition file nor a resource file are used for DOS programs. It assumes object files will have .obj for an extension, that the output file will have an .exe or .dll extension depending upon the linker options, that the map file will have an extension of .map, that the library files will have an extension of .lib, the module definition files of .def and the resource files of .res As an alternative for DOS programs you could use the compiler to call the linker, relying on the compiler's knowledge of the need for startup code and runtime libraries and its recognition of the .obj and ..lib file name extensions like this: bcc -ml -v test3.obj egavga.obj graphics.lib For Windows programming that ability is limited by its lack of recognition of resource file names. .. Ed > Stefan Schumann wrote in message > news:4056fad3$1@newsgroups.borland.com... > > Hi there! > I have big trouble in understanding the make file. > I tried to write a simple DOS program using BGI. > With BGIOBJ.exe I created egevga.obj and put it to the project folder. > Now I would like to use the commanline-tools to make an exe file but > here is my problem. > The program is quite simple, it prints a sentence and draws a rectangle: > Note that it works, when I compile the project inside the IDE. > > #include > #include > > void main (void) > { > int gdriver = DETECT, gmode; > printf("Hello, here I am"); > printf("%d",registerbgidriver(EGAVGA_driver)); > initgraph(&gdriver, &gmode, "" ); > rectangle(4, 6, 20, 50 ); > } > > Here is my makefile: > test3.exe : test3.obj > tlink -LE:\BC5\LIB -c -Tde -x test3.obj > > test3.obj : test3.c > bcc -c -P- -IE:\BC5\INCLUDE test3.c > > I tried to compile and link the Program with "make -ftest3.mak", but > then I get the following errors: > > Error: Undefined symbol _rectangle in module test3.c > Error: Undefined symbol _initgraph in module test3.c > Error: Undefined symbol _printf in module test3.c > Error: Undefined symbol _registerbgidriver in module test3.c > Error: Undefined symbol _EGAVGA_driver in module test3.c > Fatal: No program entry point > ** error 2 ** deleting test3.exe > > > Why are the symbols not included, allthough I name the correct include > and library paths, why is there no program entry point although there is > a main function? > Sure, I can create a makefile inside the IDE (which works but I tried to > understand it, without any success) but I need to work in DOS mode in > future so I would like to understand the main reasons for my problems. .