查看: 4192|回复: 6

osgEarth如何静态编译?

[复制链接]

该用户从未签到

发表于 2011-9-25 22:38:01 | 显示全部楼层 |阅读模式
VC2010下编译osgEarth 2.1的静态库没有报错,但是在编译osgEarth的sample时都出现链接错误如下:
  1. 2>osgearth_annotation.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: void __thiscall osgEarth::Symbology::Style::addSymbol(class osgEarth::Symbology::Symbol *)" (__imp_?addSymbol@Style@Symbology@osgEarth@@QAEXPAVSymbol@23@@Z)
  2. 2>osgEarthUtil.lib(Controls.obj) : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: void __thiscall osgEarth::Symbology::Style::addSymbol(class osgEarth::Symbology::Symbol *)" (__imp_?addSymbol@Style@Symbology@osgEarth@@QAEXPAVSymbol@23@@Z)
  3. 2>osgearth_annotation.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: static struct osgEarth::Symbology::Color osgEarth::Symbology::Color::Black" (__imp_?Black@Color@Symbology@osgEarth@@2U123@A)
  4. 2>osgearth_annotation.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: __thiscall osgEarth::Util::EarthManipulator::EarthManipulator(void)" (__imp_??0EarthManipulator@Util@osgEarth@@QAE@XZ)
  5. 2>osgearth_annotation.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: static struct osgEarth::Symbology::Color osgEarth::Symbology::Color::White" (__imp_?White@Color@Symbology@osgEarth@@2U123@A)
  6. 2>osgEarthUtil.lib(Controls.obj) : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: static struct osgEarth::Symbology::Color osgEarth::Symbology::Color::White" (__imp_?White@Color@Symbology@osgEarth@@2U123@A)
  7. 2>osgearth_annotation.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: __thiscall osgEarth::Util::Annotation::EllipseNode::EllipseNode(class osgEarth::MapNode *,class osg::Vec3d const &,struct osgEarth::Linear const &,struct osgEarth::Linear const &,struct osgEarth::Angular const &,class osgEarth::Symbology::Style const &,bool,unsigned int)" (__imp_??0EllipseNode@Annotation@Util@osgEarth@@QAE@PAVMapNode@3@ABVVec3d@osg@@ABULinear@3@2ABUAngular@3@ABVStyle@Symbology@3@_NI@Z)
  8. 2>osgearth_annotation.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: static struct osgEarth::Symbology::Color osgEarth::Symbology::Color::Orange" (__imp_?Orange@Color@Symbology@osgEarth@@2U123@A)
  9. ………………………………
复制代码

已在预处理器定义中添加了OSG_LIBRARY_STATIC、OT_LIBRARY_STATIC,/MT和/MD都这样,如何解决啊?

该用户从未签到

发表于 2011-11-30 12:05:25 | 显示全部楼层
静态编译出来有什么用呢。。为什么要这样做?

该用户从未签到

 楼主| 发表于 2011-12-3 17:03:30 | 显示全部楼层
静态编译之后,发布的时候就不用带一大堆的动态链接库了

该用户从未签到

发表于 2015-8-12 10:48:59 | 显示全部楼层
楼主可曾编译通过SAMPLE 和tools  我与楼主碰到同一个问题了。

该用户从未签到

发表于 2015-8-21 15:13:49 | 显示全部楼层
abstract 发表于 2015-8-12 10:48
楼主可曾编译通过SAMPLE 和tools  我与楼主碰到同一个问题了。

楼主同学,速回我问题,谢谢哈

该用户从未签到

发表于 2015-8-25 10:12:03 | 显示全部楼层
在SAMPLE 里面添加相应的预定义静态宏
e.p:

OSGEARTH_LIBRARY_STATIC
OSGEARTHANNO_LIBRARY_STATIC
等等

该用户从未签到

发表于 2015-8-25 10:57:45 | 显示全部楼层
abstract 发表于 2015-8-25 10:12
在SAMPLE 里面添加相应的预定义静态宏
e.p:

这位楼主,可否方便留个QQ?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

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

联系我们

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