Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6698695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:36:30+00:00 2026-05-26T06:36:30+00:00

=) I have a question about undefined reference to in C++. Here in this

  • 0

=)

I have a question about “undefined reference to” in C++.

Here in this code i have the next:

#include "HelloWorldAgent/helloworldagent.hh"

int main()
{
   HelloWorldAgent agent;
   agent.run();
}

In another C++ file is the next 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

I try to compile it with g++

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

And gives me the next error:

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 main':
helloworld.cc:(.text+0x29): undefined reference to
bats::HumanoidAgent::run()’
/tmp/cc1cjIEs.o: In function HelloWorldAgent::HelloWorldAgent()':
helloworld.cc:(.text._ZN15HelloWorldAgentC2Ev[_ZN15HelloWorldAgentC5Ev]+0xfd): undefined reference to
vtable for HelloWorldAgent’
/tmp/cc1cjIEs.o: In function HelloWorldAgent::~HelloWorldAgent()':
helloworld.cc:(.text._ZN15HelloWorldAgentD2Ev[_ZN15HelloWorldAgentD5Ev]+0xb): undefined reference to
vtable for HelloWorldAgent’
collect2: ld returned 1 exit status

I don’t know what could it be, maybe i’m doing something wrong. Any ideas ?

Thanks in advance. =)

PS: No, it is not homework, it is just for fun =)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T06:36:31+00:00Added an answer on May 26, 2026 at 6:36 am

    You have not included the implementation (definition) to the virtual functions in HelloWorldAgent. Make sure you pass whatever file has those definitions to G++ at the same time as the rest (or use -c to compile one at a time to .o files, then link them together in a final link step)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I came across this code: #include<stdio.h> void main() { int x; float t; scanf(%f,&t);
I have a question about locking. This doesn't have to be only about record
I have a question about using new[] . Imagine this: Object.SomeProperty = new[] {string1,
I have a question about this question . I posted a reply there but
I have this question, which i thought about earlier, but figured it's not trivial
EDIT Public health warning - this question includes a false assumption about undefined behaviour.
I'm a newbie and I have a very basic question about PHP arrays Code:
I have question about NSView: Imagine a Custom View where the mouseDown, mouseDrag and
I have question about normalization. Suppose I have an applications dealing with songs. First
I have a question about using streams in .NET to load files from disk.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.