C++ 数组的gthread.h大小为负
我的.pro文件中有以下配置C++ 数组的gthread.h大小为负,c++,qt,qt-creator,gstreamer,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. -
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
双击error会将我带到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);
}
问题似乎出在哪里?在为64位平台编译古代glib和pango时也出现了同样的错误 以下是
g\u原子\u指针\u get
source在该版本中的外观:
# 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)))
因此,这里的atomic
是gsize
,它必须具有与gpointer
相同的sizeof
,即void*
它帮助我在glibconfig.h
中将gsize
和gssize
重新定义为64位体系结构上的8字节
同时更新
GLIB\u-SIZEOF\u-VOID\u-p
,GLIB\u-SIZEOF\u-LONG
和GLIB\u-SIZEOF\u-SIZE\T我打赌g\u-atomic\u-pointer\u-get
误用了内置常量\u-p
,假设零返回保证它不是内置常量。