查看: 2217|回复: 5

刚配置好VS2013+OSG环境,运行HELLOWORLD显示飞机模型时有问题

[复制链接]

该用户从未签到

发表于 2016-4-8 16:57:58 | 显示全部楼层 |阅读模式
示例代码:
// HELLO3.cpp : 定义控制台应用程序的入口点。
//
#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 "stdafx.h"
#include<osgViewer/Viewer>
#include<osgDB/ReadFile>



int _tmain(int argc, _TCHAR* argv[])
{
        osg::ref_ptr<osgViewer::Viewer>viewer = new osgViewer::Viewer;
        viewer->setSceneData(osgDB::readNodeFile("glider.osg"));
        return viewer->run();
}

出错日志:
1>------ 已启动生成:  项目: HELLO3, 配置: Debug Win32 ------
1>  HELLO3.cpp
1>HELLO3.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: int __thiscall osg::Referenced::ref(void)const " (__imp_?ref@Referenced@osg@@QBEHXZ),该符号在函数 "public: __thiscall osg::ref_ptr<class osgViewer::Viewer>::ref_ptr<class osgViewer::Viewer>(class osgViewer::Viewer *)" (??0?$ref_ptr@VViewer@osgViewer@@@osg@@QAE@PAVViewer@osgViewer@@@Z) 中被引用
1>HELLO3.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: int __thiscall osg::Referenced::unref(void)const " (__imp_?unref@Referenced@osg@@QBEHXZ),该符号在函数 "public: __thiscall osg::ref_ptr<class osgViewer::Viewer>::~ref_ptr<class osgViewer::Viewer>(void)" (??1?$ref_ptr@VViewer@osgViewer@@@osg@@QAE@XZ) 中被引用
1>HELLO3.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: __thiscall osgViewer::Viewer::Viewer(void)" (__imp_??0Viewer@osgViewer@@QAE@XZ),该符号在函数 _wmain 中被引用
1>HELLO3.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: virtual class osg::Object * __thiscall osgViewer::Viewer::cloneType(void)const " (__imp_?cloneType@Viewer@osgViewer@@UBEPAVObject@osg@@XZ),该符号在函数 "[thunk]:public: virtual class osg::Object * __thiscall osgViewer::Viewer::cloneType`vtordisp{4294967292,0}' (void)const " (?cloneType@Viewer@osgViewer@@$4PPPPPPPM@A@BEPAVObject@osg@@XZ) 中被引用
1>HELLO3.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: virtual class osg::Object * __thiscall osgViewer::Viewer::clone(class osg::CopyOp const &)const " (__imp_?clone@Viewer@osgViewer@@UBEPAVObject@osg@@ABVCopyOp@4@@Z),该符号在函数 "[thunk]:public: virtual class osg::Object * __thiscall osgViewer::Viewer::clone`vtordisp{4294967292,0}' (class osg::CopyOp const &)const " (?clone@Viewer@osgViewer@@$4PPPPPPPM@A@BEPAVObject@osg@@ABVCopyOp@4@@Z) 中被引用
1>HELLO3.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: virtual bool __thiscall osgViewer::Viewer::isSameKindAs(class osg::Object const *)const " (__imp_?isSameKindAs@Viewer@osgViewer@@UBE_NPBVObject@osg@@@Z),该符号在函数 "[thunk]:public: virtual bool __thiscall osgViewer::Viewer::isSameKindAs`vtordisp{4294967292,0}' (class osg::Object const *)const " (?isSameKindAs@Viewer@osgViewer@@$4PPPPPPPM@A@BE_NPBVObject@osg@@@Z) 中被引用
1>HELLO3.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: virtual char const * __thiscall osgViewer::Viewer::libraryName(void)const " (__imp_?libraryName@Viewer@osgViewer@@UBEPBDXZ),该符号在函数 "[thunk]:public: virtual char const * __thiscall osgViewer::Viewer::libraryName`vtordisp{4294967292,0}' (void)const " (?libraryName@Viewer@osgViewer@@$4PPPPPPPM@A@BEPBDXZ) 中被引用
1>HELLO3.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: virtual char const * __thiscall osgViewer::Viewer::className(void)const " (__imp_?className@Viewer@osgViewer@@UBEPBDXZ),该符号在函数 "[thunk]:public: virtual char const * __thiscall osgViewer::Viewer::className`vtordisp{4294967292,0}' (void)const " (?className@Viewer@osgViewer@@$4PPPPPPPM@A@BEPBDXZ) 中被引用
1>HELLO3.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: void __thiscall osgViewer::Viewer::`vbase destructor'(void)" (__imp_??_DViewer@osgViewer@@QAEXXZ),该符号在函数 "public: virtual void * __thiscall osgViewer::Viewer::`scalar deleting destructor'(unsigned int)" (??_GViewer@osgViewer@@UAEPAXI@Z) 中被引用
1>HELLO3.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: static class osgDB::Registry * __cdecl osgDB::Registry::instance(bool)" (__imp_?instance@Registry@osgDB@@SAPAV12@_N@Z),该符号在函数 "class osg::Node * __cdecl osgDB::readNodeFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?readNodeFile@osgDB@@YAPAVNode@osg@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) 中被引用
1>HELLO3.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: class osgDB::Options * __thiscall osgDB::Registry::getOptions(void)" (__imp_?getOptions@Registry@osgDB@@QAEPAVOptions@2@XZ),该符号在函数 "class osg::Node * __cdecl osgDB::readNodeFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?readNodeFile@osgDB@@YAPAVNode@osg@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) 中被引用
1>HELLO3.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) class osg::Node * __cdecl osgDB::readNodeFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class osgDB::Options const *)" (__imp_?readNodeFile@osgDB@@YAPAVNode@osg@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBVOptions@1@@Z),该符号在函数 "class osg::Node * __cdecl osgDB::readNodeFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?readNodeFile@osgDB@@YAPAVNode@osg@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) 中被引用
1>HELLO3.obj : error LNK2001: 无法解析的外部符号 "public: virtual class osg::Node * __thiscall osg::Object::asNode(void)" (?asNode@Object@osg@@UAEPAVNode@2@XZ)
1>HELLO3.obj : error LNK2001: 无法解析的外部符号 "public: virtual class osg::Node const * __thiscall osg::Object::asNode(void)const " (?asNode@Object@osg@@UBEPBVNode@2@XZ)
1>HELLO3.obj : error LNK2001: 无法解析的外部符号 "public: virtual class osg::NodeVisitor * __thiscall osg::Object::asNodeVisitor(void)" (?asNodeVisitor@Object@osg@@UAEPAVNodeVisitor@2@XZ)
1>HELLO3.obj : error LNK2001: 无法解析的外部符号 "public: virtual class osg::NodeVisitor const * __thiscall osg::Object::asNodeVisitor(void)const " (?asNodeVisitor@Object@osg@@UBEPBVNodeVisitor@2@XZ)
1>HELLO3.obj : error LNK2001: 无法解析的外部符号 "public: virtual class osg::StateAttribute * __thiscall osg::Object::asStateAttribute(void)" (?asStateAttribute@Object@osg@@UAEPAVStateAttribute@2@XZ)
1>HELLO3.obj : error LNK2001: 无法解析的外部符号 "public: virtual class osg::StateAttribute const * __thiscall osg::Object::asStateAttribute(void)const " (?asStateAttribute@Object@osg@@UBEPBVStateAttribute@2@XZ)
1>HELLO3.obj : error LNK2001: 无法解析的外部符号 "public: virtual class osg::Uniform * __thiscall osg::Object::asUniform(void)" (?asUniform@Object@osg@@UAEPAVUniform@2@XZ)
1>HELLO3.obj : error LNK2001: 无法解析的外部符号 "public: virtual class osg::Uniform const * __thiscall osg::Object::asUniform(void)const " (?asUniform@Object@osg@@UBEPBVUniform@2@XZ)
1>HELLO3.obj : error LNK2001: 无法解析的外部符号 "public: virtual class osg::View * __thiscall osgViewer::View::asView(void)" (?asView@View@osgViewer@@UAEPAV1osg@@XZ)
1>HELLO3.obj : error LNK2001: 无法解析的外部符号 "public: virtual void __thiscall osg::Object::computeDataVariance(void)" (?computeDataVariance@Object@osg@@UAEXXZ)
1>HELLO3.obj : error LNK2001: 无法解析的外部符号 "public: virtual bool __thiscall osgViewer::View::computeIntersections(class osgGA::GUIEventAdapter const &,class std::multiset<struct osgUtil:ineSegmentIntersector::Intersection,struct std::less<struct osgUtil::LineSegmentIntersector::Intersection>,class std::allocator<struct osgUtil::LineSegmentIntersector::Intersection> > &,unsigned int)" (?computeIntersections@View@osgViewer@@UAE_NABVGUIEventAdapter@osgGA@@AAV?$multiset@UIntersection@LineSegmentIntersector@osgUtil@@U?$less@UIntersection@LineSegmentIntersector@osgUtil@@@std@@V?$allocator@UIntersection@LineSegmentIntersector@osgUtil@@@5@@std@@I@Z)
1>HELLO3.obj : error LNK2001: 无法解析的外部符号 "public: virtual bool __thiscall osgViewer::View::computeIntersections(class osgGA::GUIEventAdapter const &,class std::vector<class osg::Node *,class std::allocator<class osg::Node *> > const &,class std::multiset<struct osgUtil::LineSegmentIntersector::Intersection,struct std::less<struct osgUtil::LineSegmentIntersector::Intersection>,class std::allocator<struct osgUtil::LineSegmentIntersector::Intersection> > &,unsigned int)" (?computeIntersections@View@osgViewer@@UAE_NABVGUIEventAdapter@osgGA@@ABV?$vector@PAVNode@osg@@V?$allocator@PAVNode@osg@@@std@@@std@@AAV?$multiset@UIntersection@LineSegmentIntersector@osgUtil@@U?$less@UIntersection@LineSegmentIntersector@osgUtil@@@std@@V?$allocator@UIntersection@LineSegmentIntersector@osgUtil@@@5@@6@I@Z)
1>HELLO3.obj : error LNK2001: 无法解析的外部符号 "public: virtual class osg::Referenced * __thiscall osg::Object::getUserData(void)" (?getUserData@Object@osg@@UAEPAVReferenced@2@XZ)
1>HELLO3.obj : error LNK2001: 无法解析的外部符号 "public: virtual class osg::Referenced const * __thiscall osg::Object::getUserData(void)const " (?getUserData@Object@osg@@UBEPBVReferenced@2@XZ)
1>HELLO3.obj : error LNK2001: 无法解析的外部符号 "public: virtual void __thiscall osg::Object::releaseGLObjects(class osg::State *)const " (?releaseGLObjects@Object@osg@@UBEXPAVState@2@@Z)
1>HELLO3.obj : error LNK2001: 无法解析的外部符号 "public: virtual void __thiscall osgViewer::View::requestContinuousUpdate(bool)" (?requestContinuousUpdate@View@osgViewer@@UAEX_N@Z)
1>HELLO3.obj : error LNK2001: 无法解析的外部符号 "public: virtual void __thiscall osgViewer::View::requestRedraw(void)" (?requestRedraw@View@osgViewer@@UAEXXZ)
1>HELLO3.obj : error LNK2001: 无法解析的外部符号 "public: virtual void __thiscall osgViewer::View::requestWarpPointer(float,float)" (?requestWarpPointer@View@osgViewer@@UAEXMM@Z)
1>HELLO3.obj : error LNK2001: 无法解析的外部符号 "public: virtual void __thiscall osg::Object::resizeGLObjectBuffers(unsigned int)" (?resizeGLObjectBuffers@Object@osg@@UAEXI@Z)
1>HELLO3.obj : error LNK2001: 无法解析的外部符号 "public: virtual void __thiscall osg::Object::setName(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?setName@Object@osg@@UAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>HELLO3.obj : error LNK2001: 无法解析的外部符号 "public: virtual void __thiscall osg::Object::setThreadSafeRefUnref(bool)" (?setThreadSafeRefUnref@Object@osg@@UAEX_N@Z)
1>HELLO3.obj : error LNK2001: 无法解析的外部符号 "public: virtual void __thiscall osg::Object::setUserData(class osg::Referenced *)" (?setUserData@Object@osg@@UAEXPAVReferenced@2@@Z)
1>D:\示例练习\VC\HELLO3\Debug\HELLO3.exe : fatal error LNK1120: 34 个无法解析的外部命令
========== 生成:  成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========

请各位大神帮忙看一下,已经试了网上的很多方法,都没用,快崩溃了

该用户从未签到

 楼主| 发表于 2016-4-13 21:09:37 | 显示全部楼层
大神们都这么低调吗,小弟已经折腾好几天了,网上能试的方法都试的差不多了,就是搞不定,不知道是系统配置问题还是程序问题,所以恳请各位大神留下宝贵的意见,跪谢!!!

该用户从未签到

发表于 2016-10-28 23:47:06 | 显示全部楼层
DLL库生成有问题,应该是配置编译环境的时候有问题~尝试生成64的试一下

该用户从未签到

 楼主| 发表于 2017-3-5 22:06:20 | 显示全部楼层
泉奈 发表于 2016-10-28 23:47
DLL库生成有问题,应该是配置编译环境的时候有问题~尝试生成64的试一下

谢谢,问题已经解决了,一直没来得及回复,不好意思哈

该用户从未签到

发表于 2017-5-6 14:21:04 | 显示全部楼层
xunboqian 发表于 2017-3-5 22:06
谢谢,问题已经解决了,一直没来得及回复,不好意思哈

解决了就分享一下解决方法呗,帮助新人啊

该用户从未签到

 楼主| 发表于 2017-5-9 21:48:55 | 显示全部楼层
VC++目录:可执行文件目录->安装中的bin目录
          包含目录->安装中的include目录
链接器:常规:附加库目录->安装中的lib目录
        输入:附加依赖项:osgd.lib;osgDBd.lib;osgUtild.lib;osgGAd.lib;osgViewerd.lib;osgTextd.lib;
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

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

联系我们

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