MiniGUI在i386下编译失败(grid.c编译出错)

作者:Hily 原始链接:http://hily.me/blog/2006/09/minigui-i386-grid-c/
版权声明:可以转载,转载时务必以超链接形式标明文章原始出处作者信息版权声明

原本想在i386下用qvbf虚拟FrameBuffer来测试MiniGUI,结果编译时出错。
可能是gcc版本太高的缘故,幸好问题不是太大:)

GCC版本:

# gcc --version
gcc (GCC) 4.0.2 20050901 (prerelease) (SUSE Linux)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

MiniGUI用的是libminigui-1.3.3。 

在make menuconfig中“Controls options”部分配置为:

  │ │     [*] Static                 │ │
  │ │     [*] Button                 │ │
  │ │     [*] Simple Edit            │ │
  │ │     [*] Single-Line Edit       │ │
  │ │     [*] Multi-Line Edit        │ │
  │ │     [*] ListBox                │ │
  │ │     [*] ProgressBar            │ │
  │ │     [*] ToolBar                │ │
  │ │     [*] NewToolBar             │ │
  │ │     [*] MenuButton             │ │
  │ │     [*] TrackBar               │ │
  │ │     [*] ComboBox               │ │
  │ │     [*] PropertySheet          │ │

“Ext library options”部分配置为:

  │ │  [*] TreeView control          │ │
  │ │  [*] ListView control          │ │
  │ │  [*] Grid control              │ │
  │ │  [*] MonthCalendar control     │ │
  │ │  [*] SpinBox control           │ │
  │ │  [*] CoolBar control           │ │
  │ │  [ ] Full GIF98a support       │ │
  │ │  [ ] Skin support              │ │
  │ │  [ ] Library of VCOnGUI        │ │

“Development environment options”开发环境设置:

  │ │(Linux) Platform                │ │
  │ │(i386) Compiler                 │ │
  │ │(glibc) Libc                    │ │
  │ │--- Installation options        │ │
  │ │     Path prefix: "/usr/local"  │ │
  │ │--- Additonal Compiler Flags    │ │
  │ │     CFLAGS: ""                 │ │
  │ │     LDFLAGS: ""                │ │

make时出错如下错误:

make[3]: Entering directory `/home/work1/minigui/libminigui-1.3.3/ext/control'
source='grid.c' object='grid.lo' libtool=yes \
depfile='.deps/grid.Plo' tmpdepfile='.deps/grid.TPlo' \
depmode=gcc3 /bin/sh ../../depcomp \
/bin/sh ../../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I./ -I../include -I../../include    -D__MINIGUI_LIB__ -D_REENTRANT -O2 -Wall -Wstrict-prototypes -pipe -DNDEBUG -c -o grid.lo `test -f 'grid.c' || echo './'`grid.c
rm -f .libs/grid.lo
gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I./ -I../include -I../../include -D__MINIGUI_LIB__ -D_REENTRANT -O2 -Wall -Wstrict-prototypes -pipe -DNDEBUG -c grid.c -MT grid.lo -MD -MP -MF .deps/grid.TPlo  -fPIC -DPIC -o .libs/grid.lo
grid.c: In function 'AddCol':
grid.c:626: error: invalid lvalue in assignment
grid.c:627: error: invalid lvalue in assignment
grid.c:638: error: invalid lvalue in assignment
grid.c:639: error: invalid lvalue in assignment
grid.c:667: error: invalid lvalue in assignment
grid.c:668: error: invalid lvalue in assignment
grid.c:680: error: invalid lvalue in assignment
grid.c:681: error: invalid lvalue in assignment
grid.c: In function 'AddRow':
grid.c:733: error: invalid lvalue in assignment
grid.c:734: error: invalid lvalue in assignment
grid.c:745: error: invalid lvalue in assignment
grid.c:746: error: invalid lvalue in assignment
grid.c:774: error: invalid lvalue in assignment
grid.c:775: error: invalid lvalue in assignment
grid.c:788: error: invalid lvalue in assignment
grid.c:789: error: invalid lvalue in assignment
make[3]: *** [grid.lo] 错误 1
make[3]: Leaving directory `/home/work1/minigui/libminigui-1.3.3/ext/control'
make[2]: *** [all-recursive] 错误 1
make[2]: Leaving directory `/home/work1/minigui/libminigui-1.3.3/ext'
make[1]: *** [all-recursive] 错误 1
make[1]: Leaving directory `/home/work1/minigui/libminigui-1.3.3'
make: *** [all] 错误 2

出错文件是位于ext/control/下的grid.c,可能是编译器版本太高了,才会出现这样的错误。 

解决方法:
将grid.c中所有类似这样的代码:

      (PGRIDCOLHDR)pCell1->pRowHdr = pRowHdr;
      (PGRIDCOLHDR)pCell1->pColHdr = pCol1;

将前面的强制类型转换去掉就可以编译通过了。

-- EOF --

发表一下您的高见

If you have any question, or for the language problem, please fell free to leave a comment or just contact me with email: hilyjiang [At] Gmail.