我要发帖 回复

正式会员

4

主题

23

积分

0

专家分

:

私信
发表时间 : 2008-7-14 18:08:33 | 浏览 : 4575    评论 : 7
源代码:
#include <osgViewer/Viewer>
#include <osgDB/ReadFile>
int _tmain(int argc, _TCHAR* argv[])
{
        osgViewer::Viewer viewer;
        viewer.setSceneData( osgDB::readNodeFile( "cow.osg" ) );       
        return viewer.run();
}
错误:
test9.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall osgViewer::Viewer::`vbase destructor'(void)" (__imp_??_DViewer@osgViewer@@QAEXXZ) referenced in function _wmain
test9.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual int __thiscall osgViewer::Viewer::run(void)" (__imp_?run@Viewer@osgViewer@@UAEHXZ) referenced in function _wmain
test9.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual void __thiscall osgViewer::Viewer::setSceneData(class osg::Node *)" (__imp_?setSceneData@Viewer@osgViewer@@UAEXPAVNode@osg@@@Z) referenced in function _wmain
test9.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall osgViewer::Viewer::Viewer(void)" (__imp_??0Viewer@osgViewer@@QAE@XZ) referenced in function _wmain
test9.obj : error LNK2019: unresolved external symbol "__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::ReaderWriter::Options const *)" (__imp_?readNodeFile@osgDB@@YAPAVNode@osg@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBVOptions@ReaderWriter@1@@Z) referenced in function "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)
test9.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class osgDB::ReaderWriter::Options * __thiscall osgDB::Registry::getOptions(void)" (__imp_?getOptions@Registry@osgDB@@QAEPAVOptions@ReaderWriter@2@XZ) referenced in function "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)
test9.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class osgDB::Registry * __cdecl osgDB::Registry::instance(bool)" (__imp_?instance@Registry@osgDB@@SAPAV12@_N@Z) referenced in function "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)
D:\opgltest\test9\Debug\test9.exe : fatal error LNK1120: 7 unresolved externals

我用的是VC2005SP1,OSG2.4已安装最新的platform SDK,请各位大虾帮帮忙呀~~~

最近VR访客

湖面之舟 评论于2008-7-15 08:59:43
这个应该是依赖项没有正确的设置lib的原因吧
Sailent 评论于2008-7-15 15:50:54

回2楼

在工程属性里面已经添加了osgViewer.lib和osgDB.lib啊
znmonkey 评论于2008-7-16 10:33:09
最好是把所有lib都加进去,然后还要把lib所在路径添加进去
Sailent 评论于2008-7-17 09:02:57
问题解决了,编译成release版本就没问题了,debug版本的话要用osgViewerd.lib和osgDBd.lib,谢谢各位的帮忙
escray 评论于2013-7-2 15:11:00
我在 64 位的机器上,不慎把编译平台选成了 win32,也报了同样的错误。
http://www.cnblogs.com/zhaorui/p/20130703_osg_error_LNK2019.html
bluefish 评论于2013-7-2 23:28:09
debug版本,release版本的关联的库文件有差异
sunlb 评论于2013-9-9 20:49:57
只有extern “C”出来的标准接口才是Debug和Release通用的,c++接口依赖编译器

手机版|VR开发网 |网站地图 统计  津ICP备16006248号

GMT+8, 2017-8-24 06:29 PM

返回顶部