Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to compile a program of the C language manually on MS-DOS instead of Borland

Tags:

c

turbo-c

I need to compile a program in MS-DOS. I have the Borland editor, and I can compile the program using Alt + F9, but what does it do at the backend? I want to compile it in MS-DOS. I’m trying this:

cd c:\tc\bin
tcc -o hello.exe hello.c

where hello.c is my file, and hello.exe the file I want to produce. It's not working. What should I do? And how do I compile a .cpp file manually from MS-DOS?

like image 250
AsadYarKhan Avatar asked Dec 06 '25 01:12

AsadYarKhan


2 Answers

If I remember correctly, Borland/Turbo C compiler's command line options didn't look like gcc options. You should try tcc /? for a command line help.

like image 89
cyco130 Avatar answered Dec 07 '25 14:12

cyco130


Turbo C++ Version 3.00 Copyright (c) 1992 Borland International
Syntax is: TCC [ options ] file[s]     * = default; -x- = turn switch x off
 -1      80186/286 Instructions    -2      80286 Protected Mode Inst.
 -Ax     Disable extensions        -B      Compile via assembly
 -C      Allow nested comments     -Dxxx   Define macro
 -Exxx   Alternate Assembler name  -G      Generate for speed
 -Ixxx   Include files directory   -K      Default char is unsigned
 -Lxxx   Libraries directory       -M      Generate link map
 -N      Check stack overflow      -O      Optimize jumps
 -P      Force C++ compile         -Qxxx   Memory usage control
 -S      Produce assembly output   -Txxx   Set assembler option
 -Uxxx   Undefine macro            -Vx     Virtual table control
 -X      Suppress autodep. output  -Yx     Overlay control
 -Z      Suppress register reloads -a      Generate word alignment
 -b    * Treat enums as integers   -c      Compile only
 -d      Merge duplicate strings   -exxx   Executable file name
 -fxx    Floating point options    -gN     Stop after N warnings
 -iN     Max. identifier length    -jN     Stop after N errors
 -k      Standard stack frame      -lx     Set linker option
 -mx     Set Memory Model          -nxxx   Output file directory
 -oxxx   Object file name          -p      Pascal calls
 -r    * Register variables        -u    * Underscores on externs
 -v      Source level debugging    -wxxx   Warning control
 -y      Produce line number info  -zxxx   Set segment names

So, I think you should type:

tcc hello.c for C programs and tcc -P hello.cpp for C++ programs.

like image 23
Prof. Falken Avatar answered Dec 07 '25 13:12

Prof. Falken



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!