Search code examples
cturbo-c

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


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?


Solution

  • I believe these things must work:

    c:\tc\bin\tcc -c File.c     \\ To generate the object file
    c:\tc\bin\tcc -o File.obj   \\ To generate the EXE file from the object file. And please use .obj, not .o
    c:\tc\bin\ tcc -run File.c  \\ To generate the EXE file without the .obj file
    c:\tc\bin\File.exe          \\ To run the EXE file
    

    I don’t know why the

    tcc -o good.exe File.obj \\ Not working. The error is 'good.exe' file not found
    

    I don't think we can give a name to the .exe file on the tcc command line prompt, but it's possible in GCC. I don’t know about TCC much. If I find it, I will let you know it!

    Just take a look at these Tiny C Compiler Reference Documentation. This is what I found on Google. And googling makes you more powerful, so keep on googling the things when you don’t know.