【问题标题】:Variable has incomplete type 'struct my_error_mgr'变量的类型不完整 'struct my_error_mgr'
【发布时间】:2013-12-22 01:58:20
【问题描述】:

当我尝试构建此代码时,struct my_error_mgr jerr; 行给出错误“变量的类型不完整'struct my_error_mgr'

#import "Engine.h"
#include "jpeglib.h"

@implementation Engine
+(void)test{
    struct jpeg_decompress_struct cinfo;
    struct my_error_mgr jerr;
    FILE * infile;

    if ((infile = fopen(filename, "rb")) == NULL) {
        fprintf(stderr, "can't open %s\n", filename);
        return 0;
    }

    cinfo.err = jpeg_std_error(&jerr.pub);
    jerr.pub.error_exit = my_error_exit;

    if (setjmp(jerr.setjmp_buffer)) {
        jpeg_destroy_decompress(&cinfo);
        fclose(infile);
        return 0;
    }

    jpeg_create_decompress(&cinfo);

    jpeg_stdio_src(&cinfo, infile);

    (void) jpeg_read_header(&cinfo, TRUE);

    jvirt_barray_ptr* coeffs_array;
    coeffs_array = jpeg_read_coefficients(&cinfo);

    BOOL done = FALSE;
    for (int ci = 0; ci < 3; ci++)
    {
        JBLOCKARRAY buffer_one;
        JCOEFPTR blockptr_one;
        jpeg_component_info* compptr_one;
        compptr_one = cinfo.comp_info + ci;

        for (int by = 0; by < compptr_one->height_in_blocks; by++)
        {
            buffer_one = (cinfo.mem->access_virt_barray)((j_common_ptr)&cinfo, coeffs_array[ci], by, (JDIMENSION)1, FALSE);

            for (int bx = 0; bx < compptr_one->width_in_blocks; bx++)
            {
                blockptr_one = buffer_one[0][bx];

                for (int bi = 0; bi < 64; bi++)
                {
                    blockptr_one[bi]++;
                }                  
            }   
        } 
    }

    write_jpeg(output, &cinfo, coeffs_array); // saving modified JPEG to the output file

    jpeg_destroy_decompress(&cinfo);
    fclose(infile);
}
@end

当我尝试注释掉与此错误相关的所有行时,我会在该行上收到 EXC_BAD_ACCESS 运行时错误

(void) jpeg_read_header(&cinfo, infile);

我正在尝试修改 iOS 中保存的 JPEG 图像的 DCT 系数,最终目标是创建一个 JPEG 隐写术应用程序。我有以下代码试图为每个 DCT 系数加一个。我正在使用 libjpeg 库。代码是 Objective-C 和 C 的组合。

快速说明,变量文件名等于“/Users/ScottBouloutian/Library/Application Support/iPhone Simulator/7.0.3/Applications/27A0450​​E-4685-4C3E-AAC8-A0CC6C85359E/Crypsis.app/screen.jpg ",这是我要修改的 JPEG 图像的路径。

我的代码有什么问题?是否像缺少包含或我的文件路径有问题一样愚蠢?

【问题讨论】:

    标签: ios c compiler-errors libjpeg


    【解决方案1】:

    无论struct my_error_mgr 是什么,编译器都找不到它作为类型的声明。您需要包含具有该声明的标头。

    【讨论】:

      【解决方案2】:

      我的代码中出现以下错误:

      Variable has incomplete type 'RCTLayoutMetrics' (aka 'struct CG_BOXABLE')
      

      我升级到 Xcode 版本 9.2 (9C40b) 并解决了这个问题。

      【讨论】:

        猜你喜欢
        • 2012-02-16
        • 2021-03-19
        • 1970-01-01
        • 1970-01-01
        • 2017-08-16
        • 2011-11-28
        • 1970-01-01
        • 2017-09-14
        • 1970-01-01
        相关资源
        最近更新 更多