查看: 2299|回复: 3

OSG 2.7.9 MinGW编译问题

[复制链接]

该用户从未签到

发表于 2009-2-7 23:18:27 | 显示全部楼层 |阅读模式
环境:WINXP SP2,MinGW 5.1.4,CMake 2.6.2,OSG 2.7.9
错误:用CMake生成MinGW Makefile时只将BUILD_OSG_WRAPPERES设置为ON,其余默认,在编译osgIntrospection时出错:
[ 68%] Building CXX object src/osgIntrospection/CMakeFiles/osgIntrospection.dir/DefaultReflectors.obj
In file included from D:/OSG/OpenSceneGraph-2.7.9/include/osgIntrospection/variant_cast:19,
                 from D:/OSG/OpenSceneGraph-2.7.9/include/osgIntrospection/InstanceCreator:19,
                 from D:/OSG/OpenSceneGraph-2.7.9/include/osgIntrospection/Reflector:24,
                 from D:/OSG/OpenSceneGraph-2.7.9/include/osgIntrospection/ReflectionMacros:19,
                 from D:\OSG\OpenSceneGraph-2.7.9\src\osgIntrospection\DefaultReflectors.cpp:15:
D:/OSG/OpenSceneGraph-2.7.9/include/osgIntrospection/ReaderWriter:66: warning: ISO C++ forbids declaration of `wostream' with no type
D:/OSG/OpenSceneGraph-2.7.9/include/osgIntrospection/ReaderWriter:66: error: invalid use of `::'
D:/OSG/OpenSceneGraph-2.7.9/include/osgIntrospection/ReaderWriter:66: error: `wostream' declared as a `virtual' field
D:/OSG/OpenSceneGraph-2.7.9/include/osgIntrospection/ReaderWriter:66: error: expected `;' before '&' token
D:/OSG/OpenSceneGraph-2.7.9/include/osgIntrospection/ReaderWriter:69: error: expected `;' before "virtual"
D:/OSG/OpenSceneGraph-2.7.9/include/osgIntrospection/ReaderWriter:69: warning: ISO C++ forbids declaration of `wistream' with no type
D:/OSG/OpenSceneGraph-2.7.9/include/osgIntrospection/ReaderWriter:69: error: invalid use of `::'
D:/OSG/OpenSceneGraph-2.7.9/include/osgIntrospection/ReaderWriter:69: error: `wistream' declared as a `virtual' field
D:/OSG/OpenSceneGraph-2.7.9/include/osgIntrospection/ReaderWriter:69: error: expected `;' before '&' token
D:/OSG/OpenSceneGraph-2.7.9/include/osgIntrospection/ReaderWriter:72: error: expected `;' before "virtual"
D:/OSG/OpenSceneGraph-2.7.9/include/osgIntrospection/ReaderWriter:121: warning: ISO C++ forbids declaration of `wostream' with no type
D:/OSG/OpenSceneGraph-2.7.9/include/osgIntrospection/ReaderWriter:121: error: invalid use of `::'
D:/OSG/OpenSceneGraph-2.7.9/include/osgIntrospection/ReaderWriter:121: error: `wostream' declared as a `virtual' field
D:/OSG/OpenSceneGraph-2.7.9/include/osgIntrospection/ReaderWriter:121: error: expected `;' before '&' token
D:/OSG/OpenSceneGraph-2.7.9/include/osgIntrospection/ReaderWriter:126: error: expected `;' before "virtual"
D:/OSG/OpenSceneGraph-2.7.9/include/osgIntrospection/ReaderWriter:126: warning: ISO C++ forbids declaration of `wistream' with no type
D:/OSG/OpenSceneGraph-2.7.9/include/osgIntrospection/ReaderWriter:126: error: invalid use of `::'
D:/OSG/OpenSceneGraph-2.7.9/include/osgIntrospection/ReaderWriter:126: error: `wistream' declared as a `virtual' field
D:/OSG/OpenSceneGraph-2.7.9/include/osgIntrospection/ReaderWriter:126: error: expected `;' before '&' token
D:/OSG/OpenSceneGraph-2.7.9/include/osgIntrospection/ReaderWriter:132: error: expected `;' before "virtual"
make[2]: *** [src/osgIntrospection/CMakeFiles/osgIntrospection.dir/DefaultReflectors.obj] Error 1
make[1]: *** [src/osgIntrospection/CMakeFiles/osgIntrospection.dir/all] Error 2
make: *** [all] Error 2

OSG 2.7.8 编译时也是同样的问题,在Ubuntu 8.10下用GCC 4.3.2编译OSG 2.8.0 rc1(同样CMAKE中只改了BUILD_OSG_WRAPPERES一项)顺利通过。

该用户从未签到

发表于 2009-2-7 23:39:53 | 显示全部楼层
我没有试验过,可能是MinGW编译库还需要别的包含头文件(例如iostream)?不知道2.8版本会不会有人提出并修正这个问题。
osgIntrospection的作用是提供OSG与C++以外的其它语言的封装能力,如果用不到的话,也可以不选择它;也欢迎x_wp确认并在osg-users上提出这个问题,帮助2.8稳定版本的完善

该用户从未签到

 楼主| 发表于 2009-2-12 13:08:33 | 显示全部楼层
用官方的MINGW编译了几个版本了(包括OSG2.8rc1、rc3),都是这个问题,我在OSG-USER上问了也没人理我,实在不行就不编译OSGWAPPER了,正如版主所言,现在暂时不用。以前用TDM的GCC4.3.2编译老出问题,查了些资料才知道是TDM GCC4.3.2的一个BUG,TDM马上要更新了,等更新了再用4.3.3编译一下,希望可以通过。

还想问一个MINGW/GCC的问题,编译第三方库时不支持CMAKE,只好装了个MSYS,在MSYS环境下用configure、make、make install来编译安装。看了些资料GCC编译时-g参数表示编译DEBUG库,可是不知道如何设置参数可以在编译生成的文件名后自动加个d,以便于release库区别?谢谢!

该用户从未签到

发表于 2009-2-12 16:00:23 | 显示全部楼层
如果工程本身没有设置DEBUG库加上d后缀的话,那么就没有办法,除非手动改Makefile;这也是我们选用CMake来自动生成MakeFile的原因之一
您需要登录后才可以回帖 登录 | 注册

本版积分规则

OSG中国官方论坛-有您OSG在中国才更好

网站简介:osgChina是国内首个三维相关技术开源社区,旨在为国内更多的技术开发人员提供最前沿的技术资讯,为更多的三维从业者提供一个学习、交流的技术平台。

联系我们

  • 工作时间:09:00--18:00
  • 反馈邮箱:1315785073@qq.com
快速回复 返回顶部 返回列表