Universal header for inclusion in the C language

I am new to C, and I was wondering if there is a universal header that can be included at the beginning of the main function. In Java, it is very simple to do ctrl + shift + o in eclipse and import the packages for you. But in C, I have to do google every time and add it. Sometimes I don’t even know which library to include. Many thanks.

+3
source share
7 answers

There is no universal header, since parsing each header takes time, and there are thousands (if not millions) of headers, there is no way to include all of them in each compilation unit. You would not want this, since 99.9% of them would not be used and would only uselessly inflate the final executable with static allocations.

, man-; , malloc(3):

NAME
   calloc, malloc, free, realloc - Allocate and free dynamic
   memory

SYNOPSIS
   #include <stdlib.h>

   void *calloc(size_t nmemb, size_t size);
   void *malloc(size_t size);
   void free(void *ptr);
   void *realloc(void *ptr, size_t size);

, #include <stdlib.h> , .

, IDE, . K vim man- , , manpage, . ( printf, , printf(1), printf(3). . MANSECT, man(1), , 3 1, .)

+3

, , , . , , , man UNIX. ,

man 3 printf

:

#include <stdio.h>

int printf(const char * restrict format, ...);

, "" .

+3

, .

, MS Windows Unix, Unix Windows. Unix, X11? OpenSSL? POSIX? POSIX?

, , , . Unix "man page" ( " ", "troff/nroff" -man). , , : , POSIX man- Open.

( , , , . . C .)

+3

.

, , . IDE include.

+1

Eclipse , . : C, , , , .

. , — .

C — .

, this . , ..

, , . .

+1

, , ; , . , , ? :

  • , ,
  • 'apropos search_term' 'man interface_function'.

, №1 — /usr/include " C" ( - ).

+1

A good reference guide (such as this one ) will add an application listing all the library functions and their associated header file. You can also check the online C locale , chapter 7 for a similar listing.

0
source

All Articles