About "undefined refence to" in C++
<p>=)</p>

<p>I have a question about "undefined reference to" in C++.</p>

<p>Here in this code i have the next:</p>

<pre><code>#include "HelloWorldAgent/helloworldagent.hh"

int main()
{
   HelloWorldAgent agent;
   agent.run();
}
</code></pre>

<p>In another C++ file is the next code:</p>

<pre><code>#ifndef _HELLOWORLDAGENT_HH_
#define _HELLOWORLDAGENT_HH_

#include "../../HumanoidAgent/humanoidagent.hh"

/**
 *  A friendly robot
 */
class HelloWorldAgent : public bats::HumanoidAgent
{
/**
 * Initialize agent
*
* Called a single time when starting up the agent. Put all your initialization stuff  
here.
*/
virtual void init();

/**
* Think cycle
*
* Called at each cycle after a message from the server is received and parsed. 
Put all your thinking and acting stuff here.
*/
virtual void think();

public:

/**
*  The Constructor
*
*  Sets this agent's teamname to "Hello". Consider putting initialization stuff in 
init() instead of here.
*/
HelloWorldAgent()
: HumanoidAgent(std::string("Hello"))
{
}

};

#endif
</code></pre>

<p>I try to compile it with g++ </p>

<p>$ g++ -I /usr/include/eigen -I /usr/include/sigc++-2.0 -I /usr/lib/sigc++-2.0/include helloworld.cc</p>

<p>And gives me the next error:</p>

<p>In file included from /usr/lib/gcc/i486-slackware-linux/4.5.2/../../../../include/c++/4.5.2/ext/hash_map:60:0,
                 from HelloWorldAgent/../../HumanoidAgent/../WorldModel/../Hashclasses/hashclasses.hh:25,
                 from HelloWorldAgent/../../HumanoidAgent/../WorldModel/worldmodel.hh:54,
                 from HelloWorldAgent/../../HumanoidAgent/humanoidagent.hh:46,
                 from HelloWorldAgent/helloworldagent.hh:44,
                 from helloworld.cc:1:
/usr/lib/gcc/i486-slackware-linux/4.5.2/../../../../include/c++/4.5.2/backward/backward_warning.h:28:2: warning: #warning This file includes at least one deprecated or antiquated header which may be removed without further notice at a future date. Please use a non-deprecated interface with equivalent functionality instead. For a listing of replacement headers and interfaces, consult the file backward_warning.h. To disable this warning use -Wno-deprecated.
/tmp/cc1cjIEs.o: In function <code>main':
helloworld.cc:(.text+0x29): undefined reference to</code>bats::HumanoidAgent::run()'
/tmp/cc1cjIEs.o: In function <code>HelloWorldAgent::HelloWorldAgent()':
helloworld.cc:(.text._ZN15HelloWorldAgentC2Ev[_ZN15HelloWorldAgentC5Ev]+0xfd): undefined reference to</code>vtable for HelloWorldAgent'
/tmp/cc1cjIEs.o: In function <code>HelloWorldAgent::~HelloWorldAgent()':
helloworld.cc:(.text._ZN15HelloWorldAgentD2Ev[_ZN15HelloWorldAgentD5Ev]+0xb): undefined reference to</code>vtable for HelloWorldAgent'
collect2: ld returned 1 exit status</p>

<p>I don't know what could it be, maybe i'm doing something wrong. Any ideas ?</p>

<p>Thanks in advance. =)</p>

<p>PS: No, it is not homework, it is just for fun =)</p>
