Abiword 编译问题:bool 和 boolean 与 jpeg 库的奇怪冲突

问题描述 投票:0回答:1

我正在尝试在 MacOS 10.15.4 Catalina 上编译 Abiword-3.0.4。

为此,我已经安装了 jpeg 和 Brew 管理器包。

一旦获得源代码,

./configure
就可以了,当我输入
make
时,我在编译过程中出现以下错误:

make[6]: Entering directory '/Users/fab/Downloads/abiword-3.0.4/src/af/util/xp'
  CXX      ut_jpeg.lo
  CXX      ut_test.lo
  CXX      ut_svg.lo
  CXX      ut_timer.lo
  CXX      ut_units.lo
  CXX      ut_unicode.lo
  CXX      ut_types.lo
  CXX      ut_uuid.lo
ut_jpeg.cpp:105:9: error: cannot initialize return object of type 'boolean' with an rvalue of type 'int'
        return 1; // boolean is a libjpeg type that is an int.

所以我在

return 1
文件中查找
ut_jpeg.cpp
行,并在第 105 行找到:

static boolean _jpegFillInputBuffer (j_decompress_ptr cinfo)
{
    bytebuf_jpeg_source_ptr src = reinterpret_cast<bytebuf_jpeg_source_ptr>(cinfo->src);

    // WARNING ! this assumes that the ByteBuf will NOT change during JPEG reading.
    src->pub.next_input_byte = src->sourceBuf->getPointer (src->pos);
    src->pub.bytes_in_buffer = src->sourceBuf->getLength ();

    return 1; // boolean is a libjpeg type that is an int.
    // OTHER ATTEMPTS
    //return true;
    //return TRUE;
}

您可以看到我的另外 2 次尝试(返回 true 和返回 TRUE),均生成错误。

但是,在文件

/usr/local/include/lcms2.h
中,当我使用
return TRUE
而不是
return 1
时,宏定义良好:

#ifndef FALSE
#       define FALSE 0
#endif
#ifndef TRUE
#       define TRUE  1
#endif

似乎与 int libjpeg 类型的 boolean 发生冲突。

如何克服这个编译问题?

更新

问题是我无法访问

boolean
类型的定义:

以下命令不返回任何内容:

grep -rIHnw 'boolean' /usr/local/include/

另一个给出:

grep -rIHnw 'boolean' /opt/local/include | grep jpeg

/opt/local/include/jpeglib.h:103:  boolean sent_table;      /* TRUE when table has been output */
/opt/local/include/jpeglib.h:119:  boolean sent_table;      /* TRUE when table has been output */

也许我没有寻找正确的目录?但是,问题来自

jpeg
标头或库,不是吗?

c++ gcc boolean g++ libjpeg
1个回答
0
投票

难道是定义了宏

HAVE_BOOLEAN

作为 ijg-libjpeg 一部分的文件

jmorecfg.h
特别指出,当定义
TRUE
时,它不会定义
FALSE
/
HAVE_BOOLEAN
。无论如何,您的标签表明您正在使用 进行编译,因此您应该只使用
bool
true
false
而不是
boolean
TRUE
FALSE

请参阅

jmorecfg.h
此处

© www.soinside.com 2019 - 2024. All rights reserved.