Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

Turbo C

Original Message
Name: shahidam31
Date: October 14, 2007 at 08:57:22 Pacific
Subject: Turbo C
OS: XP
CPU/Ram: Pentium 4 3 Ghz
Model/Manufacturer: Intel
Comment:
Hi im trying to make an exe file from my source file (test.cpp) in the command prompt.

I am able to create the .obj file successfully by using the typing the follwing command

tcc test.cpp(source file name)

it successfully creates the test.obj file. Now i want to use the linker (tlink.exe) to convert the test.obj to test.exe


when i type:-

tlink test.obj

it does create the test.exe file and a test.map file but with the following error messages

Error: undefined symbol _getch in module test.cpp

Error: undefined symbol _printf in module test.cpp

Error: undefined symbol _clrscr in module test.cpp

but when the exe file run it dosent work properly and is very small in size.

i am able to create the exe file by using the tcc.exe. I want to know the how to create the exe straight from the .obj file by using the tlink

thanks


SAM


Report Offensive Message For Removal


Response Number 1
Name: dtech10
Date: October 17, 2007 at 14:26:56 Pacific
Subject: Turbo C
Reply: (edit)
Hi Sam
It's a long time since I programed in C, but this might help you.

1, Are you using Turbo C or Turbo C++
2, The routines routines Getche and Clrscr are not standard ANSI C they were in Turbo C Ver 2.
3 At the start of your program have you included these commands above your Main() {}
#include <conio.h>
#include <stdio.h>
4 Rename the extension to test.c and try
tcc test.c
tlink test.exe,test.obj

Not sure about 4 try "tlink /?" for options


Report Offensive Follow Up For Removal

Response Number 2
Name: shahidam31
Date: October 17, 2007 at 19:48:59 Pacific
Subject: Turbo C
Reply: (edit)
Hi thanks for the reply I'm using turbo C++ version 3.
I have included conio.h and stdio.h header files above my main.
The program compiles and fine within the turbo editor.
It also compiles and makes the .obj file and .exe file when I type TCC test.c

I then erase the exe file. Then try to make the .exe file again but this time using the .obj file by using the TLINK version 5

TLINK test.c gives the error messages "undefined symbol"
do I have to type the names of the library files after the syntax. If so whats the correct syntax. I think the TLINK.exe uses the path obtained from the tlink.cfg file where I have given the path as LC:\tc\lib

still does not work the way youve told?


SAM


Report Offensive Follow Up For Removal

Response Number 3
Name: dtech10
Date: October 18, 2007 at 07:32:54 Pacific
Subject: Turbo C
Reply: (edit)
Hi Sam

The tlink syntax from the command line that I remember is.

TLink obj,exe,map,lib

If you have say 3 obj files to compile

Tlink Name1+Name2+Name3,NameOfExe,,LibFile

Put blank comma's where Map. if you don't want a map file created.

Hope this helps


Report Offensive Follow Up For Removal

Response Number 4
Name: dtech10
Date: October 18, 2007 at 07:56:57 Pacific
Subject: Turbo C
Reply: (edit)
Hi Sam
I just found Ver 7 on my system.
Just type TLink to see it's syntax.
My version displays this.
Turbo Link Version 7.1.30.1. Copyright (c) 1987, 1996 Borland International
Syntax: TLINK objfiles, exefile, mapfile, libfiles, deffile, resfiles
@xxxx indicates use response file xxxx
/x No map
/m Map including public names
/M Map with mangled public names
/s Map plus detailed segment map
/l Map plus source line #s
/i Initialize all segments
/L Specify library search paths
/n Ignore default libraries
/v Full symbolic debug information
/Tti Specify target & image type
t can be d = DOS (default)
w = Windows
x = DPMI
i can be e=EXE or d=DLL
/3 Enable 32-bit processing
/o Overlay switch
/P[=dd] Pack code segments
/Vd.d Expected Windows version
/j Specify object search paths

/c Case sensitive symbols
/C Case sensitive exports & imports
/ye Expanded memory swapping
/yx Extended memory swapping
/d Warn if duplicate symbols in libraries
/f Inhibit optimizing far calls to near
/Gx Goodies
n=discard Nonresident name table
r=transfer Resident names to
nonresident names table
/A=dd Set segment alignment
/R[mpekv] Specify option to RLINK
/t Create COM file (same as /Tdc)
/k Suppress "No stack" warning msg
/Ox Optimizations
c=chained fixups
i=iterated data
a=minimum segment alignment
r=minimum resource alignment


Report Offensive Follow Up For Removal

Response Number 5
Name: shahidam31
Date: October 19, 2007 at 01:48:19 Pacific
Subject: Turbo C
Reply: (edit)
Hi dtech10
Thanks very much for the great help. I have tried the same syntax you told.
Thats is :-

TLINK test.obj,test.exe,test.map

It does create the exe file with the name test.exe with the errors mentioned previously. Actually i didnt put the "LIB file" you mentioned. Do you think thats the problem. According to my knowledge the linnker would be using path mentioned in the in the text file TLINK.CFG to locate the appropriate library files needed for the linking process to make the final executable file. The TLINK.CFG is in the same directory of TLINK.EXE. The path given in TLINK.CFG is -LD:\tc\lib.
I have checked the d:\tc\lib folder and it contains about 28 files with extension .LIB and .OBJ.
So could you tell me the name of the library file used just to print a simple program like "Hello World". I will then type:-

TLINK Hello.cpp, Hello.exe,, "LIB file"

Just to see if it works.


Report Offensive Follow Up For Removal


Response Number 6
Name: shahidam31
Date: October 19, 2007 at 01:52:23 Pacific
Subject: Turbo C
Reply: (edit)
Oh so sorry

The last syntax I mentioned was not hello .cpp, its hello.obj

correct one is

TLINK Hello.obj, Hello.exe,, "LIB file"


SAM


Report Offensive Follow Up For Removal

Response Number 7
Name: dtech10
Date: October 19, 2007 at 14:56:22 Pacific
Subject: Turbo C
Reply: (edit)
Hi Sam

Post your program Hello World here.
you don't need a Lib file unless your'e created routines yourself that you call up.

I mean something as simple as this won't
compile correctly on your system.

/* Test Program */
main() {
printf("\nHello World\n");
}


Report Offensive Follow Up For Removal

Response Number 8
Name: shahidam31
Date: October 20, 2007 at 15:10:00 Pacific
Subject: Turbo C
Reply: (edit)
Yes thats the same program! I compiled the program successfuly using the following syntax to make the .obj file only.

TCC -c test.cpp

and a file named test.obj was produced
Then I typed the following to make the final
.exe file

TLINK test.obj

It came up with the error messages told I u.

could you please advise the syntax for this program.



Report Offensive Follow Up For Removal

Response Number 9
Name: shahidam31
Date: October 20, 2007 at 15:26:20 Pacific
Subject: Turbo C
Reply: (edit)
Refer to the previous message the messages displayed were:-

turbo link version 5.0 copyright (c) 1992 borland international
Error: Undefined symbol_PRINTF in module HELLO.CPP
Warning: No stack

Does it mean that the compiler was unable to find the command from the turbo C onbuilt library? could you please explain yo me in brief what the compiler does in this program.
Does it use the header files once in .obj forma also during the linking process by the TLINK.exe?

Thanks
SAM


Report Offensive Follow Up For Removal

Response Number 10
Name: dtech10
Date: October 21, 2007 at 06:03:46 Pacific
Subject: Turbo C
Reply: (edit)
Hi Sam
I no expert, and my only experence is will Turbo C.

It seems to me that maybe Turbo C has'nt installed correctly because TCC can find it's files but TLINK can'nt.

Maybe it's the path that TLINK can't find.

Enter PATH at the command prompt and change it path if nneded and try again.
If not these paths don't exist in the path then aad them, youre directories may be different ofcourse and try TLINK again.

;c:\TurboC;c:\TurboC\Include;TurboC\LIb

\Include...Includes Haeader files those ending in *.h
\Lib.... Includes files ending in *.obj and *.lib.

Also have you tryed tc which runs Inntegated Delvolopment Enveronment and try to run your program from there.

What doe's -c option do with the TCC command.
If if to do with creating a com file, leave it out a try again.



Report Offensive Follow Up For Removal

Response Number 11
Name: shahidam31
Date: October 25, 2007 at 05:36:33 Pacific
Subject: Turbo C
Reply: (edit)
HI dtech10!

sorry for the delay. I am having a PC problems.
I used TCC -c option becos using it will create the .obj file only(compile only).
It wont create the exe file. If I type TCC without -c then it first compile to an .obj file and automatically runs TLINK within it to create the .exe file as well.
I want the two steps to be done manually by me.
My program works well inside the IDE. When I run it within the IDE it creates a .obj and a .exe file in the tc\bin folder.
I want to do it in the command prompt.
I thought the function of the linker was to link the .obj file produced by the TCC(compiler) with the necessary library files
(both of which are in the machine code) to make up the final .exe file (machine code executable).

And about the paths... does these paths you specified needs to be entered into special config file. I mean the TURBO.CFG file?
Thanks very much
REGARDS
SAM


Report Offensive Follow Up For Removal

Response Number 12
Name: dtech10
Date: October 26, 2007 at 12:58:42 Pacific
Subject: Turbo C
Reply: (edit)
Hi Sam
I believe Turbo.cfg is for the IDE.
Do this and see if it helps.

1,Right click "My Computer" on the desktop and select "Properties"
2, Select "Advanced Tab" and click on "Environment Variables" button.
3, Scrol down to find "Path" and click the "Edit" button.
4, Add the paths seperated by semi-colons and when done click the "OK" button.
5, Exit, and try to compile to see if it now finds the files required.


Report Offensive Follow Up For Removal

Response Number 13
Name: shahidam31
Date: October 28, 2007 at 11:31:03 Pacific
Subject: Turbo C
Reply: (edit)
Its still the same when I run the tlink.

Typing TLINK star.obj

results in:-
Error:undefined symbol _getch in module star.cpp
Error:undefined symbol _PRINTF in module
star.cpp
Error:undefined symbol _CLRSCR in module star.cpp

However when the TCC star.cpp is typed at command prompt the star.obj file and star.exe is produced succcessfully.

Note:- star.cpp is just a simple program with a nested for loop for displaying the following stars.

*
**
***
****

So what might be the problem with the TLINK unable to function alone.


Report Offensive Follow Up For Removal

Response Number 14
Name: antycorp
Date: December 12, 2007 at 08:06:23 Pacific
Subject: Turbo C
Reply: (edit)
i don`t speak english but i'm going to try answering you. First, in the directory lib copy the files (c0s.obj and cs.lib) and pasted them on the directory where you have your program.

when you use tlink put c0s in the obj and agree cs in the libraries:
tlink: prog.obj+c0s.obj,(name for your .exe),,cs.lib

Well that´s all


Report Offensive Follow Up For Removal



Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Turbo C

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software




XP Installed to G?

exessive internet traffic

ZoneAlarm Question. Blocked Connect

Windows Live Messenger Problem

Delete $Uninstall after SP3 updates


The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk. Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE

All content ©1996-2007 Computing.Net, LLC