|
From: Huang Y. <air...@gm...> - 2010-03-31 06:06:14
|
Hi, all.
Today I tried to modify the main.cpp in rcssserver3d and run my test. But I
got the following link error:
--------------------------------------------
CMakeFiles/rcssserver3d.dir/main.cpp.o: In function
`boost::shared_ptr<BallStateAspect>
boost::shared_dynamic_cast<BallStateAspect,
zeitgeist::Leaf>(boost::shared_ptr<zeitgeist::Leaf> const&)':
main.cpp:(.text._ZN5boost19shared_dynamic_castI15BallStateAspectN9zeitgeist4LeafEEENS_10shared_ptrIT_EERKNS4_IT0_EE[boost::shared_ptr<BallStateAspect>
boost::shared_dynamic_cast<BallStateAspect,
zeitgeist::Leaf>(boost::shared_ptr<zeitgeist::Leaf> const&)]+0x29):
undefined reference to `typeinfo for BallStateAspect'
collect2: ld returned 1 exit status
make[2]: *** [rcssserver3d/rcssserver3d] Error 1
make[1]: *** [rcssserver3d/CMakeFiles/rcssserver3d.dir/all] Error 2
make: *** [all] Error 2
---------------------------------------------
Here is my modification: (main.cpp is the modified version, main.bak.cpp is
the original one)
--- main.cpp 2010-03-31 13:54:31.000000000 +0800
+++ main.bak.cpp 2010-03-24 13:02:38.000000000 +0800
@@ -2,7 +2,7 @@
this file is part of rcssserver3D
Fri May 9 2003
Copyright (C) 2003 Koblenz University
- $Id: main.cpp 140 2010-01-10 23:45:10Z hedayat $
+ $Id: main.cpp 181 2010-02-28 10:55:34Z marianbuchta $
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -25,12 +25,6 @@
#include <kerosin/renderserver/rendercontrol.h>
#include <kerosin/inputserver/inputcontrol.h>
-#include <salt/vector.h>
-#include <oxygen/agentaspect/agentaspect.h>
-#include <../plugin/soccer/ball/ball.h>
-#include <../plugin/soccer/soccerbase/soccerbase.h>
-#include <../plugin/soccer/soccertypes.h>
-#include <../plugin/soccer/ballstateaspect/ballstateaspect.h>
#ifdef HAVE_CONFIG_H
#undef PACKAGE_NAME
#include <rcssserver3d_config.h>
@@ -77,7 +71,7 @@
GetLog()->Normal()
<< "rcssserver3d (formerly simspark), a monolithic simulator
0.6.1\n"
<< "Copyright (C) 2004 Markus Rollmann, \n"
- << "Universit?t Koblenz.\n"
+ << "Universität Koblenz.\n"
<< "Copyright (C) 2004-2009, "
<< "The RoboCup Soccer Server Maintenance Group.\n"
<< "\nType '--help' for further information\n\n";
@@ -134,7 +128,7 @@
GetScriptServer()->Run(mScriptPath);
// tell the inputControl node the loaction of our camera
- shared_ptr<InputControl> inputCtr = GetInputControl();
+ boost::shared_ptr<InputControl> inputCtr = GetInputControl();
if (inputCtr.get() != 0)
{
inputCtr->SetFPSController("/usr/scene/camera/physics/controller");
@@ -142,63 +136,26 @@
return true;
}
-SimSpark sparkinstance("../../");
-void Test(){
- SimSpark *spark=&sparkinstance;
- int cycle=0;
- while(cycle<=0){
- cycle=spark->GetSimulationServer()->GetCycle();
- cout <<cycle <<endl;
- spark->GetLog()->Normal()<< "Simulation Server was running\\n";
- }
- boost::shared_ptr<Ball> ball;
- shared_ptr<Scene> scene=spark->GetActiveScene();
-
- /*
- ball = shared_dynamic_cast<Ball>
- (spark->GetCore()->Get(scene->GetFullPath() + "Ball"));
- shared_ptr<BallStateAspect> ballStateAspect =
shared_dynamic_cast<BallStateAspect>
-
(spark->GetCore()->Get("/sys/server/gamecontrol/BallStateAspect"));
- boost::shared_ptr<oxygen::AgentAspect> agent =
spark->GetSimulationServer()->
- GetGameControlServer()->GetAgentAspect(1);
- */
-
-
-
- const salt::Vector3f force(1.0,2.0,3.0);
- const salt::Vector3f torque(1.0,2.0,3.0);
-
- //ball->SetAcceleration(cycle, force,torque,agent);
- //ball->PrePhysicsUpdateInternal(10);
- //spark->GetSimulationServer()->GetSceneServer()->
-
- while(true){
- //cout << agent->ID() << endl;
- }
-}
int main(int argc, char** argv)
{
// the spark app framework instance
-
-
- if (! sparkinstance.Init(argc, argv))
+ SimSpark spark("../../");
+
+ if (! spark.Init(argc, argv))
{
return 1;
}
- boost::thread thrd(Test);
- //thrd.detach();
-
- sparkinstance.GetSimulationServer()->Run(argc,argv);
- thrd.join();
- shared_ptr<RenderControl> renderCtr = sparkinstance.GetRenderControl();
+ spark.GetSimulationServer()->Run(argc,argv);
+
+ boost::shared_ptr<RenderControl> renderCtr = spark.GetRenderControl();
if (renderCtr.get() != 0)
{
- sparkinstance.GetLog()->Normal()
+ spark.GetLog()->Normal()
<< "Average FPS: "
<< renderCtr->GetFramesRendered() /
- sparkinstance.GetSimulationServer()->GetTime()
+ spark.GetSimulationServer()->GetTime()
<< "\n";
}
The link error appeared after I uncomment the following lines:
===========================================
- ball = shared_dynamic_cast<Ball>
- (spark->GetCore()->Get(scene->GetFullPath() + "Ball"));
- shared_ptr<BallStateAspect> ballStateAspect =
shared_dynamic_cast<BallStateAspect>
-
(spark->GetCore()->Get("/sys/server/gamecontrol/BallStateAspect"));
- boost::shared_ptr<oxygen::AgentAspect> agent =
spark->GetSimulationServer()->
- GetGameControlServer()->GetAgentAspect(1);
===========================================
And I search on the net for the type of the error. It seems that some
classes in the hierarchy have some null non-pure virtual functions.
What's the real problem about this error?? How do I get the modification
work??
--
Best regards,
Yaolong Huang(Curtis)
Tianjin University, China
Blog: http://blog.csdn.net/airekans/
|