鱼C论坛

 找回密码
 立即注册
查看: 1747|回复: 8

[已解决]用#include含括外部檔案,會直接嵌入還是連接整合???

[复制链接]
发表于 2022-5-17 13:01:50 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
教材課後練習的題目太迷惑了,前面也沒有解釋嵌入和什麼連接整合的定義和差別,問的啥阿???
在C語言中有這兩個名詞的動作的定義嗎???
最佳答案
2022-5-17 13:21:03
那就换一个教材?
没听过这两个名词
#include 是预处理器指令,作用是把 指定的文件内容复制到 这个#include指令的位置
gcc 的 -E 选项,让编译器在预处理完成后退出,不再进行之后的编译、汇编、连接
$ ls
abcd  main.c
$ cat main.c
int begin = 1;
#include "abcd"
char end = 2;
$ cat abcd
hello world!
1234567890
qwertyuiop[]
asdfghjkkl;'a'
zxcvbnm,./
$ gcc -E main.c
# 0 "main.c"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 0 "<command-line>" 2
# 1 "main.c"
int begin = 1;
# 1 "abcd" 1
hello world!
1234567890
qwertyuiop[]
asdfghjkkl;'a'
zxcvbnm,./
# 3 "main.c" 2
char end = 2;
$
278402344_2857423277894246_2567131991843837011_n.jpg
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2022-5-17 13:18:00 | 显示全部楼层
本帖最后由 wp231957 于 2022-5-17 13:19 编辑

我们先拿一个最简单的c代码  来看:
#include <stdio.h>

int main() 
{
    printf("ok");
    return 0;
}

经过预编译器处理后的文档如下:


# 1 "ct3.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "ct3.c"
# 1 "d:\\mingw64\\include\\stdio.h" 1 3
# 38 "d:\\mingw64\\include\\stdio.h" 3
      
# 39 "d:\\mingw64\\include\\stdio.h" 3
# 56 "d:\\mingw64\\include\\stdio.h" 3
# 1 "d:\\mingw64\\include\\_mingw.h" 1 3
# 55 "d:\\mingw64\\include\\_mingw.h" 3
      
# 56 "d:\\mingw64\\include\\_mingw.h" 3
# 66 "d:\\mingw64\\include\\_mingw.h" 3
# 1 "d:\\mingw64\\include\\msvcrtver.h" 1 3
# 35 "d:\\mingw64\\include\\msvcrtver.h" 3
      
# 36 "d:\\mingw64\\include\\msvcrtver.h" 3
# 67 "d:\\mingw64\\include\\_mingw.h" 2 3






# 1 "d:\\mingw64\\include\\w32api.h" 1 3
# 35 "d:\\mingw64\\include\\w32api.h" 3
      
# 36 "d:\\mingw64\\include\\w32api.h" 3
# 59 "d:\\mingw64\\include\\w32api.h" 3
# 1 "d:\\mingw64\\include\\sdkddkver.h" 1 3
# 35 "d:\\mingw64\\include\\sdkddkver.h" 3
      
# 36 "d:\\mingw64\\include\\sdkddkver.h" 3
# 60 "d:\\mingw64\\include\\w32api.h" 2 3
# 74 "d:\\mingw64\\include\\_mingw.h" 2 3
# 57 "d:\\mingw64\\include\\stdio.h" 2 3
# 69 "d:\\mingw64\\include\\stdio.h" 3
# 1 "d:\\mingw64\\lib\\gcc\\mingw32\\6.3.0\\include\\stddef.h" 1 3 4
# 216 "d:\\mingw64\\lib\\gcc\\mingw32\\6.3.0\\include\\stddef.h" 3 4

# 216 "d:\\mingw64\\lib\\gcc\\mingw32\\6.3.0\\include\\stddef.h" 3 4
typedef unsigned int size_t;
# 328 "d:\\mingw64\\lib\\gcc\\mingw32\\6.3.0\\include\\stddef.h" 3 4
typedef short unsigned int wchar_t;
# 357 "d:\\mingw64\\lib\\gcc\\mingw32\\6.3.0\\include\\stddef.h" 3 4
typedef short unsigned int wint_t;
# 70 "d:\\mingw64\\include\\stdio.h" 2 3
# 94 "d:\\mingw64\\include\\stdio.h" 3
# 1 "d:\\mingw64\\include\\sys/types.h" 1 3
# 34 "d:\\mingw64\\include\\sys/types.h" 3
      
# 35 "d:\\mingw64\\include\\sys/types.h" 3
# 62 "d:\\mingw64\\include\\sys/types.h" 3
  typedef long __off32_t;




  typedef __off32_t _off_t;







  typedef _off_t off_t;
# 91 "d:\\mingw64\\include\\sys/types.h" 3
  typedef long long __off64_t;






  typedef __off64_t off64_t;
# 115 "d:\\mingw64\\include\\sys/types.h" 3
  typedef int _ssize_t;







  typedef _ssize_t ssize_t;
# 95 "d:\\mingw64\\include\\stdio.h" 2 3







# 1 "d:\\mingw64\\lib\\gcc\\mingw32\\6.3.0\\include\\stdarg.h" 1 3 4
# 40 "d:\\mingw64\\lib\\gcc\\mingw32\\6.3.0\\include\\stdarg.h" 3 4
typedef __builtin_va_list __gnuc_va_list;
# 103 "d:\\mingw64\\include\\stdio.h" 2 3
# 210 "d:\\mingw64\\include\\stdio.h" 3
typedef struct _iobuf
{
  char *_ptr;
  int _cnt;
  char *_base;
  int _flag;
  int _file;
  int _charbuf;
  int _bufsiz;
  char *_tmpfname;
} FILE;
# 239 "d:\\mingw64\\include\\stdio.h" 3
extern __attribute__((__dllimport__)) FILE _iob[];
# 252 "d:\\mingw64\\include\\stdio.h" 3








__attribute__((__cdecl__)) __attribute__((__nothrow__)) FILE * fopen (const char *, const char *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) FILE * freopen (const char *, const char *, FILE *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int fflush (FILE *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int fclose (FILE *);






__attribute__((__cdecl__)) __attribute__((__nothrow__)) int remove (const char *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int rename (const char *, const char *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) FILE * tmpfile (void);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) char * tmpnam (char *);


__attribute__((__cdecl__)) __attribute__((__nothrow__)) char *_tempnam (const char *, const char *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int _rmtmp (void);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int _unlink (const char *);
# 289 "d:\\mingw64\\include\\stdio.h" 3
__attribute__((__cdecl__)) __attribute__((__nothrow__)) char * tempnam (const char *, const char *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int rmtmp (void);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int unlink (const char *);



__attribute__((__cdecl__)) __attribute__((__nothrow__)) int setvbuf (FILE *, char *, int, size_t);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) void setbuf (FILE *, char *);
# 342 "d:\\mingw64\\include\\stdio.h" 3
extern int __attribute__((__cdecl__)) __attribute__((__nothrow__)) __attribute__((__format__(__mingw_printf__,2,3))) __mingw_fprintf(FILE*, const char*, ...);
extern int __attribute__((__cdecl__)) __attribute__((__nothrow__)) __attribute__((__format__(__mingw_printf__,1,2))) __mingw_printf(const char*, ...);
extern int __attribute__((__cdecl__)) __attribute__((__nothrow__)) __attribute__((__format__(__mingw_printf__,2,3))) __mingw_sprintf(char*, const char*, ...);
extern int __attribute__((__cdecl__)) __attribute__((__nothrow__)) __attribute__((__format__(__mingw_printf__,3,4))) __mingw_snprintf(char*, size_t, const char*, ...);
extern int __attribute__((__cdecl__)) __attribute__((__nothrow__)) __attribute__((__format__(__mingw_printf__,2,0))) __mingw_vfprintf(FILE*, const char*, __builtin_va_list);
extern int __attribute__((__cdecl__)) __attribute__((__nothrow__)) __attribute__((__format__(__mingw_printf__,1,0))) __mingw_vprintf(const char*, __builtin_va_list);
extern int __attribute__((__cdecl__)) __attribute__((__nothrow__)) __attribute__((__format__(__mingw_printf__,2,0))) __mingw_vsprintf(char*, const char*, __builtin_va_list);
extern int __attribute__((__cdecl__)) __attribute__((__nothrow__)) __attribute__((__format__(__mingw_printf__,3,0))) __mingw_vsnprintf(char*, size_t, const char*, __builtin_va_list);
# 376 "d:\\mingw64\\include\\stdio.h" 3
extern unsigned int _mingw_output_format_control( unsigned int, unsigned int );
# 453 "d:\\mingw64\\include\\stdio.h" 3
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int fprintf (FILE *, const char *, ...);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int printf (const char *, ...);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int sprintf (char *, const char *, ...);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int vfprintf (FILE *, const char *, __builtin_va_list);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int vprintf (const char *, __builtin_va_list);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int vsprintf (char *, const char *, __builtin_va_list);
# 478 "d:\\mingw64\\include\\stdio.h" 3
int __attribute__((__cdecl__)) __attribute__((__nothrow__)) __attribute__((__format__(__ms_printf__,2,3))) __msvcrt_fprintf(FILE *, const char *, ...);
int __attribute__((__cdecl__)) __attribute__((__nothrow__)) __attribute__((__format__(__ms_printf__,1,2))) __msvcrt_printf(const char *, ...);
int __attribute__((__cdecl__)) __attribute__((__nothrow__)) __attribute__((__format__(__ms_printf__,2,3))) __msvcrt_sprintf(char *, const char *, ...);
int __attribute__((__cdecl__)) __attribute__((__nothrow__)) __attribute__((__format__(__ms_printf__,2,0))) __msvcrt_vfprintf(FILE *, const char *, __builtin_va_list);
int __attribute__((__cdecl__)) __attribute__((__nothrow__)) __attribute__((__format__(__ms_printf__,1,0))) __msvcrt_vprintf(const char *, __builtin_va_list);
int __attribute__((__cdecl__)) __attribute__((__nothrow__)) __attribute__((__format__(__ms_printf__,2,0))) __msvcrt_vsprintf(char *, const char *, __builtin_va_list);






__attribute__((__cdecl__)) __attribute__((__nothrow__)) int _snprintf (char *, size_t, const char *, ...);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int _vsnprintf (char *, size_t, const char *, __builtin_va_list);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int _vscprintf (const char *, __builtin_va_list);
# 501 "d:\\mingw64\\include\\stdio.h" 3
__attribute__((__cdecl__)) __attribute__((__nothrow__)) __attribute__((__format__(__mingw_printf__,3,4)))
int snprintf (char *, size_t, const char *, ...);

__attribute__((__cdecl__)) __attribute__((__nothrow__)) __attribute__((__format__(__mingw_printf__,3,0)))
int vsnprintf (char *, size_t, const char *, __builtin_va_list);

__attribute__((__cdecl__)) __attribute__((__nothrow__))
int vscanf (const char * __restrict__, __builtin_va_list);

__attribute__((__cdecl__)) __attribute__((__nothrow__))
int vfscanf (FILE * __restrict__, const char * __restrict__, __builtin_va_list);

__attribute__((__cdecl__)) __attribute__((__nothrow__))
int vsscanf (const char * __restrict__, const char * __restrict__, __builtin_va_list);
# 646 "d:\\mingw64\\include\\stdio.h" 3
__attribute__((__cdecl__)) __attribute__((__nothrow__)) ssize_t
getdelim (char ** __restrict__, size_t * __restrict__, int, FILE * __restrict__);

__attribute__((__cdecl__)) __attribute__((__nothrow__)) ssize_t
getline (char ** __restrict__, size_t * __restrict__, FILE * __restrict__);
# 666 "d:\\mingw64\\include\\stdio.h" 3
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int fscanf (FILE *, const char *, ...);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int scanf (const char *, ...);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int sscanf (const char *, const char *, ...);



__attribute__((__cdecl__)) __attribute__((__nothrow__)) int fgetc (FILE *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) char * fgets (char *, int, FILE *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int fputc (int, FILE *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int fputs (const char *, FILE *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) char * gets (char *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int puts (const char *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int ungetc (int, FILE *);
# 687 "d:\\mingw64\\include\\stdio.h" 3
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int _filbuf (FILE *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int _flsbuf (int, FILE *);



extern inline __attribute__((__gnu_inline__)) __attribute__((__cdecl__)) __attribute__((__nothrow__)) int getc (FILE *);
extern inline __attribute__((__gnu_inline__)) __attribute__((__cdecl__)) __attribute__((__nothrow__)) int getc (FILE * __F)
{
  return (--__F->_cnt >= 0)
    ? (int) (unsigned char) *__F->_ptr++
    : _filbuf (__F);
}

extern inline __attribute__((__gnu_inline__)) __attribute__((__cdecl__)) __attribute__((__nothrow__)) int putc (int, FILE *);
extern inline __attribute__((__gnu_inline__)) __attribute__((__cdecl__)) __attribute__((__nothrow__)) int putc (int __c, FILE * __F)
{
  return (--__F->_cnt >= 0)
    ? (int) (unsigned char) (*__F->_ptr++ = (char)__c)
    : _flsbuf (__c, __F);
}

extern inline __attribute__((__gnu_inline__)) __attribute__((__cdecl__)) __attribute__((__nothrow__)) int getchar (void);
extern inline __attribute__((__gnu_inline__)) __attribute__((__cdecl__)) __attribute__((__nothrow__)) int getchar (void)
{
  return (--(&_iob[0])->_cnt >= 0)
    ? (int) (unsigned char) *(&_iob[0])->_ptr++
    : _filbuf ((&_iob[0]));
}

extern inline __attribute__((__gnu_inline__)) __attribute__((__cdecl__)) __attribute__((__nothrow__)) int putchar(int);
extern inline __attribute__((__gnu_inline__)) __attribute__((__cdecl__)) __attribute__((__nothrow__)) int putchar(int __c)
{
  return (--(&_iob[1])->_cnt >= 0)
    ? (int) (unsigned char) (*(&_iob[1])->_ptr++ = (char)__c)
    : _flsbuf (__c, (&_iob[1]));}
# 734 "d:\\mingw64\\include\\stdio.h" 3
__attribute__((__cdecl__)) __attribute__((__nothrow__)) size_t fread (void *, size_t, size_t, FILE *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) size_t fwrite (const void *, size_t, size_t, FILE *);



__attribute__((__cdecl__)) __attribute__((__nothrow__)) int fseek (FILE *, long, int);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) long ftell (FILE *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) void rewind (FILE *);
# 787 "d:\\mingw64\\include\\stdio.h" 3
typedef long long fpos_t;




__attribute__((__cdecl__)) __attribute__((__nothrow__)) int fgetpos (FILE *, fpos_t *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int fsetpos (FILE *, const fpos_t *);



__attribute__((__cdecl__)) __attribute__((__nothrow__)) int feof (FILE *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int ferror (FILE *);
# 808 "d:\\mingw64\\include\\stdio.h" 3
__attribute__((__cdecl__)) __attribute__((__nothrow__)) void clearerr (FILE *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) void perror (const char *);






__attribute__((__cdecl__)) __attribute__((__nothrow__)) FILE * _popen (const char *, const char *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int _pclose (FILE *);


__attribute__((__cdecl__)) __attribute__((__nothrow__)) FILE * popen (const char *, const char *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int pclose (FILE *);




__attribute__((__cdecl__)) __attribute__((__nothrow__)) int _flushall (void);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int _fgetchar (void);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int _fputchar (int);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) FILE * _fdopen (int, const char *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int _fileno (FILE *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int _fcloseall (void);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) FILE * _fsopen (const char *, const char *, int);

__attribute__((__cdecl__)) __attribute__((__nothrow__)) int _getmaxstdio (void);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int _setmaxstdio (int);
# 859 "d:\\mingw64\\include\\stdio.h" 3
unsigned int __attribute__((__cdecl__)) __mingw_get_output_format (void);
unsigned int __attribute__((__cdecl__)) __mingw_set_output_format (unsigned int);







int __attribute__((__cdecl__)) __mingw_get_printf_count_output (void);
int __attribute__((__cdecl__)) __mingw_set_printf_count_output (int);
# 885 "d:\\mingw64\\include\\stdio.h" 3
extern inline __attribute__((__gnu_inline__)) __attribute__((__always_inline__)) unsigned int __attribute__((__cdecl__)) _get_output_format (void)
{ return __mingw_get_output_format (); }

extern inline __attribute__((__gnu_inline__)) __attribute__((__always_inline__)) unsigned int __attribute__((__cdecl__)) _set_output_format (unsigned int __style)
{ return __mingw_set_output_format (__style); }
# 910 "d:\\mingw64\\include\\stdio.h" 3
extern inline __attribute__((__gnu_inline__)) __attribute__((__always_inline__)) int __attribute__((__cdecl__)) _get_printf_count_output (void)
{ return 0 ? 1 : __mingw_get_printf_count_output (); }

extern inline __attribute__((__gnu_inline__)) __attribute__((__always_inline__)) int __attribute__((__cdecl__)) _set_printf_count_output (int __mode)
{ return 0 ? 1 : __mingw_set_printf_count_output (__mode); }



__attribute__((__cdecl__)) __attribute__((__nothrow__)) int fgetchar (void);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int fputchar (int);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) FILE * fdopen (int, const char *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int fileno (FILE *);
# 930 "d:\\mingw64\\include\\stdio.h" 3
extern inline __attribute__((__gnu_inline__)) __attribute__((__always_inline__)) FILE * __attribute__((__cdecl__)) __attribute__((__nothrow__)) fopen64 (const char *, const char *);
extern inline __attribute__((__gnu_inline__)) __attribute__((__always_inline__))
FILE * __attribute__((__cdecl__)) __attribute__((__nothrow__)) fopen64 (const char * filename, const char * mode)
{ return fopen (filename, mode); }

int __attribute__((__cdecl__)) __attribute__((__nothrow__)) fseeko64 (FILE *, __off64_t, int);






extern inline __attribute__((__gnu_inline__)) __attribute__((__always_inline__)) __off64_t __attribute__((__cdecl__)) __attribute__((__nothrow__)) ftello64 (FILE *);
extern inline __attribute__((__gnu_inline__)) __attribute__((__always_inline__))
__off64_t __attribute__((__cdecl__)) __attribute__((__nothrow__)) ftello64 (FILE * stream)
{ fpos_t __pos; return (fgetpos(stream, &__pos)) ? -1LL : (__off64_t)(__pos); }
# 958 "d:\\mingw64\\include\\stdio.h" 3
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int fwprintf (FILE *, const wchar_t *, ...);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int wprintf (const wchar_t *, ...);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int vfwprintf (FILE *, const wchar_t *, __builtin_va_list);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int vwprintf (const wchar_t *, __builtin_va_list);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int _snwprintf (wchar_t *, size_t, const wchar_t *, ...);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int _vscwprintf (const wchar_t *, __builtin_va_list);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int _vsnwprintf (wchar_t *, size_t, const wchar_t *, __builtin_va_list);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int fwscanf (FILE *, const wchar_t *, ...);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int wscanf (const wchar_t *, ...);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int swscanf (const wchar_t *, const wchar_t *, ...);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) wint_t fgetwc (FILE *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) wint_t fputwc (wchar_t, FILE *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) wint_t ungetwc (wchar_t, FILE *);




__attribute__((__cdecl__)) __attribute__((__nothrow__)) int swprintf (wchar_t *, const wchar_t *, ...);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int vswprintf (wchar_t *, const wchar_t *, __builtin_va_list);



__attribute__((__cdecl__)) __attribute__((__nothrow__)) wchar_t * fgetws (wchar_t *, int, FILE *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int fputws (const wchar_t *, FILE *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) wint_t getwc (FILE *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) wint_t getwchar (void);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) wint_t putwc (wint_t, FILE *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) wint_t putwchar (wint_t);


__attribute__((__cdecl__)) __attribute__((__nothrow__)) wchar_t * _getws (wchar_t *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int _putws (const wchar_t *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) FILE * _wfdopen(int, const wchar_t *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) FILE * _wfopen (const wchar_t *, const wchar_t *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) FILE * _wfreopen (const wchar_t *, const wchar_t *, FILE *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) FILE * _wfsopen (const wchar_t *, const wchar_t *, int);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) wchar_t * _wtmpnam (wchar_t *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) wchar_t * _wtempnam (const wchar_t *, const wchar_t *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int _wrename (const wchar_t *, const wchar_t *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int _wremove (const wchar_t *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) void _wperror (const wchar_t *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) FILE * _wpopen (const wchar_t *, const wchar_t *);






__attribute__((__cdecl__)) __attribute__((__nothrow__)) int snwprintf (wchar_t *, size_t, const wchar_t *, ...);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int vsnwprintf (wchar_t *, size_t, const wchar_t *, __builtin_va_list);
# 1016 "d:\\mingw64\\include\\stdio.h" 3
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int vwscanf (const wchar_t *__restrict__, __builtin_va_list);
__attribute__((__cdecl__)) __attribute__((__nothrow__))
int vfwscanf (FILE *__restrict__, const wchar_t *__restrict__, __builtin_va_list);
__attribute__((__cdecl__)) __attribute__((__nothrow__))
int vswscanf (const wchar_t *__restrict__, const wchar_t * __restrict__, __builtin_va_list);






__attribute__((__cdecl__)) __attribute__((__nothrow__)) FILE * wpopen (const wchar_t *, const wchar_t *);




__attribute__((__cdecl__)) __attribute__((__nothrow__)) wint_t _fgetwchar (void);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) wint_t _fputwchar (wint_t);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int _getw (FILE *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int _putw (int, FILE *);




__attribute__((__cdecl__)) __attribute__((__nothrow__)) wint_t fgetwchar (void);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) wint_t fputwchar (wint_t);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int getw (FILE *);
__attribute__((__cdecl__)) __attribute__((__nothrow__)) int putw (int, FILE *);





# 2 "ct3.c" 2


# 3 "ct3.c"
int main()
{
    printf("ok");
    return 0;
}

评分

参与人数 1荣誉 +1 鱼币 +1 贡献 +1 收起 理由
一隻太平洋睡鯊 + 1 + 1 + 1 這就是台上一兩行,台下幾百行嗎OAO!

查看全部评分

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2022-5-17 13:21:03 | 显示全部楼层    本楼为最佳答案   
那就换一个教材?
没听过这两个名词
#include 是预处理器指令,作用是把 指定的文件内容复制到 这个#include指令的位置
gcc 的 -E 选项,让编译器在预处理完成后退出,不再进行之后的编译、汇编、连接
$ ls
abcd  main.c
$ cat main.c
int begin = 1;
#include "abcd"
char end = 2;
$ cat abcd
hello world!
1234567890
qwertyuiop[]
asdfghjkkl;'a'
zxcvbnm,./
$ gcc -E main.c
# 0 "main.c"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 0 "<command-line>" 2
# 1 "main.c"
int begin = 1;
# 1 "abcd" 1
hello world!
1234567890
qwertyuiop[]
asdfghjkkl;'a'
zxcvbnm,./
# 3 "main.c" 2
char end = 2;
$

评分

参与人数 1荣誉 +1 鱼币 +1 贡献 +1 收起 理由
一隻太平洋睡鯊 + 1 + 1 + 1 原來是复制了,感覺類似變量的複本?

查看全部评分

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2022-5-17 13:25:21 | 显示全部楼层
人造人 发表于 2022-5-17 13:21
那就换一个教材?
没听过这两个名词
#include 是预处理器指令,作用是把 指定的文件内容复制到 这个#incl ...

但是我比较经过预处理后的代码  和stdio.h的文档 不很一样啊
stdio.h有1000多行呢,我这个预处理后,才几百行啊

评分

参与人数 1贡献 +2 收起 理由
一隻太平洋睡鯊 + 2 超過剩餘了,抱歉TWT

查看全部评分

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2022-5-17 15:36:19 | 显示全部楼层
wp231957 发表于 2022-5-17 13:25
但是我比较经过预处理后的代码  和stdio.h的文档 不很一样啊
stdio.h有1000多行呢,我这个预处理后,才 ...

预处理器指令不是复制,预处理器指令是执行的

评分

参与人数 1荣誉 +1 鱼币 +1 贡献 +1 收起 理由
一隻太平洋睡鯊 + 1 + 1 + 1 還沒學到預處理器的部分TWT

查看全部评分

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2022-5-17 15:39:07 | 显示全部楼层
预处理器指令不复制
$ ls
abcd  main.c
$ cat main.c
#include "abcd"

char b[X];

int main(void) {

    return 0;
}
$ cat abcd
#define X 123

int x[X];
$ gcc -E main.c
# 0 "main.c"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 0 "<command-line>" 2
# 1 "main.c"
# 1 "abcd" 1


int x[123];
# 2 "main.c" 2

char b[123];

int main(void) {

    return 0;
}
$

评分

参与人数 1贡献 +3 收起 理由
一隻太平洋睡鯊 + 3 超過剩餘了,抱歉TWT

查看全部评分

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2022-5-17 17:32:28 | 显示全部楼层
本帖最后由 一隻太平洋睡鯊 于 2022-5-17 17:33 编辑

其實我看不太懂上面兩位大佬在說啥
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2022-5-17 20:14:36 | 显示全部楼层
一样一样{:10_266:
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2022-5-17 20:39:05 | 显示全部楼层
新源 发表于 2022-5-17 20:14
一样一样{:10_266:

啊這
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-12-30 04:30

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表