Click here to Skip to main content
15,912,578 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi,
I am working in TC on window XP.I want to know how to make a code reusable in TC(like printf,etc.) which required .h file in Include Folder & respective .lib File in LIB folder. And how to make this .lib files.
Plz,if someone knows this,plz help me.
Thank You.
Posted

You may want to start out be reading the
Thinking in C++ 2nd Edition by Bruce Eckel - Free Electronic Book Volume 1 & Volume 2[^].

You probably need to read some TC specific material too. tlib is the utility that enables you to combine .obj files into a library (.lib)

On the other hand I would really consider moving to Visual C++ 2010 Express[^], it's available for free too.

Regards
Espen Harlinn
 
Share this answer
 
v2
Comments
[no name] 20-Feb-11 13:28pm    
thanks.
Sergey Alexandrovich Kryukov 20-Feb-11 17:22pm    
Another interesting book on C++ I never knew (I hardly read much except Bjarne Stroustrup, which is not for everyone).
Thank you very much, 5.
What could you say about quality of this book, maybe I can recommend it to others?
--SA
Espen Harlinn 20-Feb-11 17:46pm    
It's free, it's not bad - very good value for the money.
For a primer, possibly, but not as readable as Stanley Lippman, nor particularly exiting – but it does take you through the initial steps of learning C++.
Sergey Alexandrovich Kryukov 20-Feb-11 18:02pm    
Thank you.
Bookmarked, will take a look.
"Exiting" is not a requirement :-) I don't know how about "exciting", but when somebody recommend something "cool" first signal I get causes me to ask myself first "how can I avoid it" :-)
--SA
Espen Harlinn 20-Feb-11 18:11pm    
Back in the early 90's I found books like "Compiler Design in C" inspiring, http://www.holub.com/publications/other/slaying_the_dragon.html
Learning to design and develop programs is a h*ll of a lot of work, so some inspiration is always good :)
Save your code.h file into include folder(C:\TC\INCLUDE\). Now you can use it like printf function just after adding #include<<code.h>>. You may can add the prototype on that header file to reduce adding prototype in your main code.
TC3.0 may not support to build/export user define lib(may I don't know).
But TC5.** supports this. So you can try this in TC5.**.
 
Share this answer
 
v2
Comments
[no name] 20-Feb-11 13:28pm    
thanks.
You should build a static library.
Turbo C++ 3.0 (sorry I've just this one) has the Application menu, from wich you may select "Library" as the output of your application.
If your version of Turbo C has not such a menu (or command line linker option), you may consider to use a more update IDE (for instance Visual C++ 2010 Express Edition[^] that is freely available).

[update, source: Schildt's book "Turbo C - The Complete Reference", 1988 (!)]
Since version 1.5, Turbo C comes with TLIB.EXE, hence you my build your own static library using the command line:
TLIB library_name [operator]module_name [operator]module_name ...

where:
  • library_name is the name of your library (TC automatically append the .LIB extension, if you didn't provide one).
  • operator is one of the following:
    + adds the module to the library.
    - remove the module from the library.
    * extract the specified .OBJ file from the library.
    -+ replaces the module inside the library.
    -* extract the specified module file and removes it from the library.
    
  • module_name is the name of your object file (again TC assumes .OBJ extension if not specified).

[/update]
:)
 
Share this answer
 
v5
Comments
Yusuf 20-Feb-11 11:08am    
fixed typo: bild=>build.
CPallini 20-Feb-11 11:31am    
Thank you. :-)
Espen Harlinn 20-Feb-11 12:50pm    
Would have thought this an obvious 5 - didn’t that book feature a medieval army on its cover?
CPallini 20-Feb-11 15:46pm    
Nope, however, I have also the 'Dragon book'. :-D
Espen Harlinn 20-Feb-11 16:06pm    
The green of the purple one? Seems like an expedition into the attic is in order, for some reason I've never been able to trow those old tomes away, though I'm pretty sure I'm not going to need those books on OS/2 and DOS ever :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900