G e t t i n g S t a r t e d
----------------------------------------------------------------------
Q. How do I install Turbo C?
A. Run the INSTALL program from the INSTALL/HELP disk. To start
the installation, change your current drive to the one that
has the install program on it and type INSTALL. You will be
given instructions in a box at the bottom of the screen for
each prompt. For example, if you will be installing from
drive A:, type:
A:
INSTALL
At this point, the INSTALL program will appear with menus
selections and descriptions to guide you through the installation
process.
Q. How do I run Turbo C?
A. After you have installed Turbo C, type "TC" from the DOS
prompt and you're ready to go. Chapter 2 (Getting Started)
of the Turbo C User's Guide will guide you through your
first Turbo C program.
Q. What is the difference between TC.EXE and TCC.EXE?
A. The Turbo C package comes with two compilers, an Integrated
Environment named TC.EXE and a command-line compiler named
TCC.EXE. The Integrated Environment is essentially
the command-line compiler with an integrated editor,
linker, and debugger. Please refer to the Turbo C
User's Guide for details on using both systems.
Q. What is a configuration file?
A. A configuration file tells Turbo C what options to default to
and where to look for its library and header files. TC.EXE
looks for a configuration file named TCCONFIG.TC, and
TCC.EXE looks for a file named TURBOC.CFG. See the User's
Guide, pages 40 and 143 for more information.
Q. How do I create a configuration file?
A. When you run the INSTALL program it creates a configuration
file named TURBOC.CFG for TCC.EXE. This file is just an
ASCII file which you can change with any text editor. It
contains the path information for the library and header
files for TCC.EXE to use. The INSTALL program does not
create a TCCONFIG.TC file for TC.EXE because it installs
the directory information directly into TC.EXE. You can
create a configuration file for TC.EXE by running TC,
setting your options however you want to set them, and
typing Alt-O/S.
I n t e g r a t e d E n v i r o n m e n t
----------------------------------------------------------------------
Q. Why is Turbo C not able to find any of my #include files?
A. The compiler searches for include files in the Turbo C Include
Directories. This option is specified under the Options/Directories
menu. The INSTALL program initially sets this option to the
directory where it copied all the Turbo C *.h files.
Q. Why do I get the message:
Linker Error: Unable to open input file 'C0x.OBJ'
A. The linker searches for Turbo C start-up and library files in the
Turbo C Library Directories. This option is specified under the
Options/Directories menu. The INSTALL program initially sets this
option to a directory where it copied the start-up and library
files.
Q. Why does the linker tell me that all the graphics library
routines are undefined?
A. The Options/Linker/Graphics Library item must be set ON, if
you are using any Turbo C graphics functions and have not
specifyed GRAPHICS.LIB in a project file.
G e n e r a l I / O
----------------------------------------------------------------------
Q. The '\n' in cprintf() does not return the cursor to the
beginning of the line. It only moves the cursor down one line.
A. cprintf() no longer interprets '\n' as a Carriage Return/
Line Feed combination. The '\n' only outputs a Line Feed. To
force the cursor to the beginning of the line, manually
insert a Carriage Return:
cprintf("\n\r");
E x a m p l e P r o g r a m s
----------------------------------------------------------------------
Q. How do I compile the MICROCALC spread sheet?
A. See Appendix G of the Turbo C Reference Manual.
G r a p h i c s
----------------------------------------------------------------------
Q. Why do I get the error message:
BGI Error: graphics not initialized (use 'initgraph')
when I use a graphics function? My program has already
called initgraph().
A. For some reason initgraph() failed. To find out why, check
the return value of graphresult(). For example:
#include <graphics.h>
main()
{
int gerr; /* graphics error */
int gdriver = DETECT, gmode;
/* Initialize graphics using auto-detection and look
for the .BGI and .CHR files in the C:\TURBOC directory.
*/
initgraph(&gdriver, &gmode, "C:\\TURBOC");
if ((gerr = graphresult()) != grOk)
{
printf("Error : %s\n", grapherrormsg(gerr));
exit(1);
}
:
}
M a t h / F l o a t i n g P o i n t
----------------------------------------------------------------------
Q. Why do I get incorrect results from all the math library
functions like cos() and tan()?
A. You must #include <math.h> before you call any of the standard
Turbo C math functions. In general, Turbo C assumes that a function
that is not declared returns an int. In the case of math functions,
they usually return a double. For example
/* WRONG */ /* RIGHT */
#include <math.h>
main() main()
{ {
printf("%f", cos(0)); printf("%f", cos(0));
} }
L i n k e r E r r o r s
----------------------------------------------------------------------
Q. Why do I get the message:
Linker Error: Unable to open input file 'C0x.OBJ'
A. See "Integrated Environment" section above.
Q. Why does the linker tell me that all the graphics library
routines are undefined?
A. See the "Integrated Environment" and "Command-line Compiler"
sections above.