前言
错误 LNK2019 无法解析的外部符号 "__declspec(dllimport) public: int __thiscall osg::Referenced::ref(void)const " (_imp?ref@Referenced@osg@@QBEHXZ),函数 “public: __thiscall osg::ref_ptr::ref_ptr(class osg::Group *)” (??0?$ref_ptr@VGroup@osg@@@osg@@QAE@PAVGroup@1@@Z) 中引用了该符号

```cpp
#include "osg/geode"
#include "osg/group"
#include "osg/Ref_Ptr"
#include "osgViewer/viewer"
#include "osgDB/ReadFile"
//using namespace osg;
int main(int argc, char** argv)
{
osg::ref_ptr<osg::Group> top = new osg::Group;
top->addChild(new osg::Geode);
osgViewer::Viewer viewer;
viewer.setSceneData(osgDB::readNodeFile("cow.osg"));
return viewer.run();
}
# 报错

# 问题原因
我编译的是osg版本是:OpenSceneGraph-3.6.5-master
生成64位版本的,而工程却是win32
# 解决
1.把解决方案平台给成x64

# 运行结果


本文介绍了一种常见的OSG编程错误——LNK2019错误,并详细解释了错误产生的原因及如何通过调整项目设置来解决此问题。
36万+

被折叠的 条评论
为什么被折叠?



