gthread.h数组的大小是负数

时间:2012-05-15 09:03:33

标签: c++ qt qt-creator gstreamer

我的.pro文件中有以下配置

INCLUDEPATH += /home/vickey/ossbuild-read-only/Shared/Build/Linux/x86/include/glib-2.0/
CONFIG += link_pkgconfig
PKGCONFIG += gstreamer-0.10
LIBS            += -L/usr/lib `pkg-config --cflags --libs gstreamer-0.10`
LIBS        += -L. -L/usr/lib -lphonon -lcurl -ltag -fopenmp -lsayonara_gstreamer

当我尝试构建项目时,我收到以下错误

/home/vickey/src/player/../../../../ossbuild-read-only/Shared/Build/Linux/x86/include/glib-2.0/glib/gthread.h:-1: In function 'gboolean g_once_init_enter(volatile gsize*)':

/home/vickey/src/player/../../../../ossbuild-read-only/Shared/Build/Linux/x86/include/glib-2.0/glib/gthread.h:348: error: size of array is negative

双击错误将我带到gthread.h文件,下面的行指向

g_once_init_enter (volatile gsize *value_location)
{
  if G_LIKELY ((gpointer) g_atomic_pointer_get (value_location) != NULL)
    return FALSE;
  else
    return g_once_init_enter_impl (value_location);
}

似乎是什么问题?

1 个答案:

答案 0 :(得分:0)

在64位平台上编译古代glib和pango时遇到同样的错误。

以下是g_atomic_pointer_get来源在该版本中的显示方式:

# define g_atomic_pointer_get(atomic) \
 ((void) sizeof (gchar [sizeof (*(atomic)) == sizeof (gpointer) ? 1 : -1]), \
  (g_atomic_pointer_get) ((volatile gpointer G_GNUC_MAY_ALIAS *) (volatile void *) (atomic)))

因此,此处atomicgsize,其sizeof必须与gpointer相同,即void*

它帮助我在gsize的64位架构上重新定义gssizeglibconfig.h为8字节。

同时更新GLIB_SIZEOF_VOID_PGLIB_SIZEOF_LONGGLIB_SIZEOF_SIZE_T