如上图所示,在OSG+MFC的运行环境中,当加载模型时,编译时会弹出上述错误提示;
经过查找资料,发现出现上述类似错误一般都是项目中依赖项的配置不正确引起的。
具体正确配置如下:
首先确定配置模式是Release模式还是Debug模式,
Release模式下的配置项如下:
osgViewer.lib;osgUtil.lib;osgText.lib;osgTerrain.lib;osgSim.lib;osgShadow.lib;osgParticle.lib;osgManipulator.lib;osgGA.lib;OpenThreads.lib;osg.lib;osgDB.lib;osgFX.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;user32.lib
Debug模式下的配置如下:
osgViewerd.lib;osgUtild.lib;osgTextd.lib;osgTerraind.lib;osgSimd.lib;osgShadowd.lib;osgParticled.lib;osgManipulatord.lib;osgGAd.lib;OpenThreadsd.lib;osgd.lib;osgDBd.lib;osgFXd.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;user32.lib
经过上述的配置,应该可以成功通过编译,加载模型了。