osgFX::Scribe编译不通过问题
这是杨石兴大哥书上的,可是我生成成功,运行不了,不知道怎么回事,求帮忙啊#include <iostream>
#include <osgDB/ReadFile>
#include <osgViewer/Viewer>
#include <osg/Group>
#include <osg/Node>
#include <osgFX/Scribe>
#include <osgGA/GUIEventHandler>
#include <osgUtil/LineSegmentIntersector>
class CPickHandler:public osgGA::GUIEventHandler
{
public:
CPickHandler(osgViewer::Viewer * viewer):mViewer(viewer){};
virtual bool handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &&aa)
{
switch(ea.getEventType())
{
// PUSH, button down
case osgGA::GUIEventAdapter::PUSH:
// 1,left button push
if (ea.getButton()==1)
{
Pick(ea.getX(),ea.getY());
}
return true;
}
return false;
}
protected:
void Pick(float x, float y)
{
osgUtil::LineSegmentIntersector::Intersections intersections;
if (mViewer->computeIntersections(x,y,intersections))
{
for (osgUtil::LineSegmentIntersector::Intersections::iterator hitr = intersections.begin();
hitr != intersections.end();
++ hitr)
{
if (! hitr->nodePath.empty() && ! (hitr->nodePath.back()->getName().empty()))
{
const osg::NodePath &np = hitr->nodePath;
for(int i = np.size()-1;i>=0;--i)
{
osgFX::Scribe *sc = dynamic_cast<osgFX::Scribe *> (np);
if(sc!=NULL)
{
if(sc->getNodeMask()!=0)
sc->setNodeMask(0);
}
}
}
}
}
}
osgViewer::Viewer *mViewer;
};
// argc: the number of argv
// argv: an array of arguments,
// args always is the path and name of the program itself.
int main(int argc, char** argv)
{
osg::ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer();
osg::ref_ptr<osg::Group>root = new osg::Group();
root->addChild(osgDB::readNodeFile("cessna.osg"));
osg::ref_ptr<osg::Node> cow = osgDB::readNodeFile("cow.osg");
osg::ref_ptr<osgFX::Scribe> sc = new osgFX::Scribe();
sc->addChild(cow.get());
root->addChild(cow.get());
root->addChild(sc.get());
viewer->setSceneData(root.get());
viewer->addEventHandler(new CPickHandler(viewer.get()));
viewer->realize();
viewer->run();
}
系统提示:
1>所有输出均为最新。
1>pick.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: __thiscall osgFX::Scribe::Scribe(void)" (__imp_??0Scribe@osgFX@@QAE@XZ)
1>pick.obj : error LNK2001: 无法解析的外部符号 "public: virtual class osg::Object * __thiscall osgFX::Scribe::cloneType(void)const " (?cloneType@Scribe@osgFX@@UBEPAVObject@osg@@XZ)
1>pick.obj : error LNK2001: 无法解析的外部符号 "public: virtual class osg::Object * __thiscall osgFX::Scribe::clone(class osg::CopyOp const &)const " (?clone@Scribe@osgFX@@UBEPAVObject@osg@@ABVCopyOp@4@@Z)
1>pick.obj : error LNK2001: 无法解析的外部符号 "public: virtual bool __thiscall osgFX::Scribe::isSameKindAs(class osg::Object const *)const " (?isSameKindAs@Scribe@osgFX@@UBE_NPBVObject@osg@@@Z)
1>pick.obj : error LNK2001: 无法解析的外部符号 "public: virtual char const * __thiscall osgFX::Scribe::libraryName(void)const " (?libraryName@Scribe@osgFX@@UBEPBDXZ)
1>pick.obj : error LNK2001: 无法解析的外部符号 "public: virtual char const * __thiscall osgFX::Scribe::className(void)const " (?className@Scribe@osgFX@@UBEPBDXZ)
1>pick.obj : error LNK2001: 无法解析的外部符号 "public: virtual void __thiscall osgFX::Scribe::accept(class osg::NodeVisitor &)" (?accept@Scribe@osgFX@@UAEXAAVNodeVisitor@osg@@@Z)
1>pick.obj : error LNK2001: 无法解析的外部符号 "public: virtual void __thiscall osgFX::Effect::traverse(class osg::NodeVisitor &)" (?traverse@Effect@osgFX@@UAEXAAVNodeVisitor@osg@@@Z)
1>pick.obj : error LNK2001: 无法解析的外部符号 "public: virtual char const * __thiscall osgFX::Scribe::effectName(void)const " (?effectName@Scribe@osgFX@@UBEPBDXZ)
1>pick.obj : error LNK2001: 无法解析的外部符号 "public: virtual char const * __thiscall osgFX::Scribe::effectDescription(void)const " (?effectDescription@Scribe@osgFX@@UBEPBDXZ)
1>pick.obj : error LNK2001: 无法解析的外部符号 "public: virtual char const * __thiscall osgFX::Scribe::effectAuthor(void)const " (?effectAuthor@Scribe@osgFX@@UBEPBDXZ)
1>pick.obj : error LNK2001: 无法解析的外部符号 "public: virtual void __thiscall osgFX::Effect::setUpDemo(void)" (?setUpDemo@Effect@osgFX@@UAEXXZ)
1>pick.obj : error LNK2001: 无法解析的外部符号 "protected: virtual bool __thiscall osgFX::Scribe::define_techniques(void)" (?define_techniques@Scribe@osgFX@@MAE_NXZ)
1>pick.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) protected: virtual __thiscall osgFX::Scribe::~Scribe(void)" (__imp_??1Scribe@osgFX@@MAE@XZ)
1>D:\我的C++\pick\Debug\pick.exe : fatal error LNK1120: 14 个无法解析的外部命令
1>
1>生成失败。 #pragma comment(lib,"osgFX.lib")or#pragma comment(lib,"osgFXd.lib") tubyvr 发表于 2014-5-18 21:36
#pragma comment(lib,"osgFX.lib")or#pragma comment(lib,"osgFXd.lib")
已经好了,谢谢你~~~
页:
[1]