查看: 602|回复: 1

osg帧率显示编译错误

[复制链接]

该用户从未签到

发表于 2016-12-26 08:11:49 | 显示全部楼层 |阅读模式
代码是照着书上来的。结果出错了,代码如下:
#ifdef _DEBUG
#pragma comment(lib,"osgViewerd.lib")
#pragma comment(lib,"osgDBd.lib")
#pragma comment(lib,"OpenThreadsd.lib")
#pragma comment(lib,"osgd.lib")
#else
#pragma comment(lib,"osgViewer.lib")
#pragma comment(lib,"osgDB.lib")
#pragma comment(lib,"OpenThreads.lib")
#pragma comment(lib,"osg.lib")
#endif

#include <osgViewer/Viewer>
#include <osgDB/ReadFile>
#include <osgViewer/ViewerEventHandlers>
#include <osgGA/EventHandler>

int main()
{
        osg::ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer;
        viewer->addEventHandler(new osgViewer::StatsHandler);
        viewer->setSceneData(osgDB::readNodeFile("glider.osg"));

        return viewer->run();
}

应该就是粗线那句出错,把他注释掉就没错了。
这是vs报的错误:
1>------ 已启动生成:  项目: RateDisplay, 配置: Debug Win32 ------
1>main.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: virtual class osg::Object * __thiscall osgGA::GUIEventHandler::cloneType(void)const " (__imp_?cloneType@GUIEventHandler@osgGA@@UBEPAVObject@osg@@XZ),该符号在函数 "[thunk]:public: virtual class osg::Object * __thiscall osgGA::GUIEventHandler::cloneType`vtordisp{4294967292,136}' (void)const " (?cloneType@GUIEventHandler@osgGA@@$4PPPPPPPM@II@BEPAVObject@osg@@XZ) 中被引用
1>main.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: virtual class osg::Object * __thiscall osgGA::GUIEventHandler::clone(class osg::CopyOp const &)const " (__imp_?clone@GUIEventHandler@osgGA@@UBEPAVObject@osg@@ABVCopyOp@4@@Z),该符号在函数 "[thunk]:public: virtual class osg::Object * __thiscall osgGA::GUIEventHandler::clone`vtordisp{4294967292,136}' (class osg::CopyOp const &)const " (?clone@GUIEventHandler@osgGA@@$4PPPPPPPM@II@BEPAVObject@osg@@ABVCopyOp@4@@Z) 中被引用
1>main.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: virtual bool __thiscall osgGA::GUIEventHandler::isSameKindAs(class osg::Object const *)const " (__imp_?isSameKindAs@GUIEventHandler@osgGA@@UBE_NPBVObject@osg@@@Z),该符号在函数 "[thunk]:public: virtual bool __thiscall osgGA::GUIEventHandler::isSameKindAs`vtordisp{4294967292,136}' (class osg::Object const *)const " (?isSameKindAs@GUIEventHandler@osgGA@@$4PPPPPPPM@II@BE_NPBVObject@osg@@@Z) 中被引用
1>main.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: virtual char const * __thiscall osgGA::GUIEventHandler::libraryName(void)const " (__imp_?libraryName@GUIEventHandler@osgGA@@UBEPBDXZ),该符号在函数 "[thunk]:public: virtual char const * __thiscall osgGA::GUIEventHandler::libraryName`vtordisp{4294967292,136}' (void)const " (?libraryName@GUIEventHandler@osgGA@@$4PPPPPPPM@II@BEPBDXZ) 中被引用
1>main.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: virtual char const * __thiscall osgGA::GUIEventHandler::className(void)const " (__imp_?className@GUIEventHandler@osgGA@@UBEPBDXZ),该符号在函数 "[thunk]:public: virtual char const * __thiscall osgGA::GUIEventHandler::className`vtordisp{4294967292,136}' (void)const " (?className@GUIEventHandler@osgGA@@$4PPPPPPPM@II@BEPBDXZ) 中被引用
1>E:\vs2013\RateDisplay\Debug\RateDisplay.exe : fatal error LNK1120: 5 个无法解析的外部命令
========== 生成:  成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========


osg编译的应该没问题,因为我运行 osgviewer cow.osg,能出来奶牛,也能按s显示帧率。新人小白一个,求大神帮忙看下是怎么回事?

该用户从未签到

发表于 2017-3-10 09:23:45 | 显示全部楼层
osgGA的库路径好像没有配置
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

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

联系我们

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