|
使用的开发环境是windows 7下的vs2010,使用的osg库版本为3.0.1,出现如下错误:
osg::notify(osg::NOTICE)<<"Enable Extensions OpenGL"<<std::endl;
osg::GraphicsContext* gc = viewer->getCamera()->getGraphicsContext();
unsigned int contextID = gc->getState()->getContextID();
//osg::GLBufferObject::Extensions* ext = geom->getOrCreateVertexBufferObject()->getGLBufferObject(contextID)->getExtensions(contextID,true);//获得扩展功能
osg::GLBufferObject::Extensions* ext = osg::GLBufferObject::getExtensions(contextID,true);
ext->glGenBuffers(2, vbo);
ext->glBindBuffer(GL_ARRAY_BUFFER_ARB, vbo[0]);
ext->glBufferData(GL_ARRAY_BUFFER,3*3*sizeof(float),
positionData,GL_STATIC_READ);
ext->glBindBuffer(GL_ARRAY_BUFFER_ARB, vbo[0]);
ext->glBufferData(GL_ARRAY_BUFFER,3*3*sizeof(float),
colorData,GL_STATIC_READ);
这是其中的一段源代码,出现的错误如下:
main.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: void __thiscall osg::GLBufferObject::Extensions::__glewBufferData(unsigned int,int,void const *,unsigned int)const " (__imp_?__glewBufferData@Extensions@GLBufferObject@osg@@QBEXIHPBXI@Z),该符号在函数 "class osg::ref_ptr<class osg::Geometry> __cdecl triangleScence(class osg::ref_ptr<class osgViewer::Viewer>)" (?triangleScence@@YA?AV?$ref_ptr@VGeometry@osg@@@osg@@V?$ref_ptr@VViewer@osgViewer@@@2@@Z) 中被引用
1>main.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: void __thiscall osg::GLBufferObject::Extensions::__glewBindBuffer(unsigned int,unsigned int)const " (__imp_?__glewBindBuffer@Extensions@GLBufferObject@osg@@QBEXII@Z),该符号在函数 "class osg::ref_ptr<class osg::Geometry> __cdecl triangleScence(class osg::ref_ptr<class osgViewer::Viewer>)" (?triangleScence@@YA?AV?$ref_ptr@VGeometry@osg@@@osg@@V?$ref_ptr@VViewer@osgViewer@@@2@@Z) 中被引用
1>main.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: void __thiscall osg::GLBufferObject::Extensions::__glewGenBuffers(int,unsigned int *)const " (__imp_?__glewGenBuffers@Extensions@GLBufferObject@osg@@QBEXHPAI@Z),该符号在函数 "class osg::ref_ptr<class osg::Geometry> __cdecl triangleScence(class osg::ref_ptr<class osgViewer::Viewer>)" (?triangleScence@@YA?AV?$ref_ptr@VGeometry@osg@@@osg@@V?$ref_ptr@VViewer@osgViewer@@@2@@Z) 中被引用
1>F:\osgLearnSamples\Debug\quandsOsgGLSL.exe : fatal error LNK1120: 3 个无法解析的外部命令
不晓得为啥会出现这个错误,说glBindBuffer等等函数无法解析,我的lib库应该都包含了,如下:
#ifndef COMMON_H__
#define COMMON_H__
#ifdef _DEBUG
#pragma comment(lib,"osgd.lib")
#pragma comment(lib,"osgDBd.lib")
#pragma comment(lib,"osgViewerd.lib")
#pragma comment(lib,"OpenThreadsd.lib")
#pragma comment(lib,"osgUtild.lib")
#pragma comment(lib,"osgGAd.lib")
#pragma comment(lib,"osgTextd.lib")
#else
#pragma comment(lib,"osg.lib")
#pragma comment(lib,"osgDB.lib")
#pragma comment(lib,"osgViewer.lib")
#pragma comment(lib,"OpenThreads.lib")
#pragma comment(lib,"osgUtil.lib")
#pragma comment(lib,"osgGA.lib")
#pragma comment(lib,"osgText.lib")
#endif
#endif
在vs的附加以来项中我也包含了如下lib库:
opengl32.lib
glut32.lib
glew32.lib
glew32s.lib
不晓得为啥不能解析,但是osg中给出的例子osgscreencapture中是没有问题的。说明我的电脑环境变量和运行环境不会出问题,求大神指导一下。
|
|