我有这个功能:
void simul(char *new)
{
segment_table seg = malloc(sizeof(st));
segcode newcode = malloc(sizeof(sc));
int clen = 0;
seg -> segname = new;
clen = code_length(seg -> segname);
seg -> code = read_hexcode(seg -> segname, newcode, clen);
load_image(seg, clen-3);
if (strstr(new, "paper_boot-strap loader.hexcode") == NULL)
run(segment_offset(seg));
}
当我尝试编译程序时,我收到以下错误:
error: ‘st’ undeclared (first use in this function)
error: ‘sc’ undeclared (first use in this function)
error: invalid type argument of ‘->’ (have ‘segment_table’)
error: invalid type argument of ‘->’ (have ‘segment_table’)
error: invalid type argument of ‘->’ (have ‘segment_table’)
error: invalid type argument of ‘->’ (have ‘segment_table’)
答案 0 :(得分:0)
标头文件,例如<div class="content">
<div class="wrap">
<svg viewBox="0 0 600 300" class="svg-defs">
<!-- Symbol with text -->
<symbol id="s-text">
<text text-anchor="middle" x="50%" y="50%" dy=".35em" class="text">
Couture Book
</text>
</symbol>
<!-- Mask with text -->
<mask id="m-text" maskUnits="userSpaceOnUse" maskContentUnits="userSpaceOnUse">
<rect width="100%" height="100%" class="mask__shape">
</rect>
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#s-text" class="mask__text"></use>
</mask>
</svg>
<div class="box-with-text">
<!-- Container for video -->
<div class="text-fill">
<video class="video" src="http://tympanus.net/Tutorials/AnimatedTextFills/img/bokeh2.mp4" autoplay="" loop=""></video>
</div>
<!-- Visible SVG -->
<svg viewBox="0 0 600 300" class="svg-inverted-mask">
<rect width="100%" height="100%" mask="url(#m-text)" class="shape--fill"></rect>
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#s-text" class="text--transparent"></use>
</svg>
</div>
</div>
</div>
:
header.h
一个源文件
// First an include guard (https://en.wikipedia.org/wiki/Include_guard)
#ifndef HEADER_
#define HEADER_
// Define the structures and their type-aliases
typedef struct st { ... } st;
typedef struct sc { ... } sc;
// Declare a couple of other type-aliases
// (Note that I personally recommend against declaring pointer type-aliases)
// (I personally recommend against using type-aliases for simple types
// like the above structures too)
typedef st *segment_table;
typedef sc *segcode;
// Declare a function prototype
void simul(char *new);
#endif // HEADER_
第二个源文件
#include "header.h"
void simul(char *new)
{
...
}