Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question about library

Status
Not open for further replies.

xailer

Programmer
Nov 6, 2003
13
SI
hi

Is stdio.h considered a library or just a header file?
Is standard library already compiled ?
What file extension does library have?

In which library is printf() defined?

tahnk you very much
 
Dear Xailer,

STDIO.H is header file and Library files are not always compiled, sometimes you need to compile it explicitely. And library files have extension .LIB

You can find printf() function defined in STDIO.H

Regards,

Ketan.
 
The libraries tend to vary from system to system. On Unix it is libc.so or libc.sl. No idea whatsoever about windows even though I use it every day.
 
hi

So printf() is only declared in stdio.h,but not defined?Instead it is defined in some library?

Which libraries do get automaticaly linked,by compiler,to a program I compile and run?

thank you for y0our help
 
It depends on your compiler and OS. Some compilers/linkers

1) will automatically pick up the relevant libraries
2) may have a standard set and you have to tell them the additional ones
3) will have to be told about every library that is required.
 
The header files for the standard C library are listed here
The new C99 standard adds a few more to this list.

With the exception of math.h, all these should be resolved by the 'libc' library which comes with your compiler. Historically in unix (and laterly linux), math.h has been resolved by 'libm' (which you needed to specify). PC based compilers also had a separate 'libm', but they used some heuristics to guess whether you needed it or not. Sometimes they guess wrong and the "Floating point not linked" message would appear at run-time.

As xwb has already said, the rest depends on your compiler. Windows compilers automatically search the core windows API libraries without you having to do anything extra.

The short answer is, if it's anything other than one of the standard C headers, you should at least consider that you'll need to find the appropriate library to resolve any of the symbols you use from those header files.

Most manual pages tell you which header files you need, and which libraries to search.

--
 
hi

You've all been of great help

thank you
bye
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top