Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/65.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c libcss中的css_样式表_create()(错误:函数调用的参数太多)_Objective C_C_Xcode4_Struct_Typedef - Fatal编程技术网

Objective c libcss中的css_样式表_create()(错误:函数调用的参数太多)

Objective c libcss中的css_样式表_create()(错误:函数调用的参数太多),objective-c,c,xcode4,struct,typedef,Objective C,C,Xcode4,Struct,Typedef,我试图在Objective C中实现一个C库(libcss)。我得到一个“函数调用的参数太多,预期4个,在函数css\u样式表\u create上有13个”() css\u样式表\u创建定义: /** * Parameter block for css_stylesheet_create() */ typedef struct css_stylesheet_params { /** ABI version of this struc

我试图在Objective C中实现一个C库(libcss)。我得到一个“函数调用的参数太多,预期4个,在函数css\u样式表\u create上有13个”()

css\u样式表\u创建定义:

   /** 
    *  Parameter block for css_stylesheet_create() 
    */ 

    typedef struct css_stylesheet_params {
            /** ABI version of this structure */
            uint32_t params_version;


            /** The language level of the stylesheet */
            css_language_level level;
            /** The charset of the stylesheet data, or NULL to detect */
            const char *charset;
            /** URL of stylesheet */
            const char *url;
            /** Title of stylesheet */
            const char *title;

            /** Permit quirky parsing of stylesheet */
            bool allow_quirks;
            /** This stylesheet is an inline style */
            bool inline_style;

            /** URL resolution function */
            css_url_resolution_fn resolve;
            /** Client private data for resolve */
            void *resolve_pw;

            /** Import notification function */
            css_import_notification_fn import;
            /** Client private data for import */
            void *import_pw;

            /** Colour resolution function */
            css_color_resolution_fn color;
            /** Client private data for color */
            void *color_pw;

            /** Font resolution function */
            css_font_resolution_fn font;
            /** Client private data for font */
            void *font_pw;
   } css_stylesheet_params;

css_error css_stylesheet_create(const css_stylesheet_params *params,
        css_allocator_fn alloc, void *alloc_pw,
        css_stylesheet **stylesheet);

原型要求4个参数,调用有13个参数

看看这个。他们正在完全更改
css\u样式表\u create
函数。也就是说,他们将所有参数嵌入
css\u样式表\u参数
,从而将参数数量从13个减少到
css\u样式表\u创建

所以你需要这样打电话-

css_stylesheet_params params;

params.level = CSS_LEVEL_DEFAULT;
params.charset = "UTF-8";
params.url = "";
params.title = NULL;
params.allow_quirks = false;
params.inline_style = false;
params.resolve = resolve_url;
params.resolve_pw = NULL;
params.import = NULL;
params.import_pw = NULL;
params.color = NULL;
params.color_pw = NULL;

css_stylesheet_create(&params, myrealloc, NULL, &sheet)

原型要求4个参数,调用有13个参数

看看这个。他们正在完全更改
css\u样式表\u create
函数。也就是说,他们将所有参数嵌入
css\u样式表\u参数
,从而将参数数量从13个减少到
css\u样式表\u创建

所以你需要这样打电话-

css_stylesheet_params params;

params.level = CSS_LEVEL_DEFAULT;
params.charset = "UTF-8";
params.url = "";
params.title = NULL;
params.allow_quirks = false;
params.inline_style = false;
params.resolve = resolve_url;
params.resolve_pw = NULL;
params.import = NULL;
params.import_pw = NULL;
params.color = NULL;
params.color_pw = NULL;

css_stylesheet_create(&params, myrealloc, NULL, &sheet)

是的,请检查,在函数声明中,您只提供了4个参数,但您调用的函数包含4个以上的参数

 css_error css_stylesheet_create(const css_stylesheet_params *params,  
       css_allocator_fn alloc, void *alloc_pw,
         css_stylesheet **stylesheet);

是的,请检查,在函数声明中,您只提供了4个参数,但您调用的函数包含4个以上的参数

 css_error css_stylesheet_create(const css_stylesheet_params *params,  
       css_allocator_fn alloc, void *alloc_pw,
         css_stylesheet **stylesheet);

我用新数据编辑了我的答案。检查并查看它是否有助于我用新数据编辑我的答案。检查一下,看看它是否有帮助。我是“纯C”的新手,所以我不知道。(函数调用来自libcss示例代码,所以我认为代码是正确的。但它似乎被破坏了。)@Olof是的。示例代码将过时,不会有人提及它,我们将陷入困境:(.没关系,一切都有解决方案:)我是“纯C”新手,所以我一无所知。(函数调用来自libcss示例代码,所以我认为代码是正确的。但它似乎被破坏了。)@Olof是的。示例代码将过时,不会有任何提及,我们将陷入困境:(.没关系,所有问题都有解决方案:)