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

  • SEARCH
  • Home
  • 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 429047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T19:44:12+00:00 2026-05-12T19:44:12+00:00

Everything is fine and the final problem is so annoying. Compile is great but

  • 0

Everything is fine and the final problem is so annoying. Compile is great but link fails:

bash-3.2$ make
g++ -Wall -c -g Myworld.cc
g++ -Wall -g solvePlanningProblem.o Position.o AStarNode.o PRM.o PRMNode.o World.o SingleCircleWorld.o Myworld.o RECTANGLE.o CIRCLE.o -o solvePlanningProblem

**Undefined symbols:

"vtable for Obstacle", referenced from:
      Obstacle::Obstacle()in Myworld.o

"typeinfo for Obstacle", referenced from:
      typeinfo for RECTANGLEin RECTANGLE.o
      typeinfo for CIRCLEin CIRCLE.o

ld: symbol(s) not found

collect2: ld returned 1 exit status

make: *** [solvePlanningProblem] Error 1**

Obstacle.hh

#ifndef Obstacle_hh 
#define Obstacle_hh

#include <vector>
#include <iostream>

class Obstacle{
public:
    Obstacle(){}
    virtual bool collidesWith(double x,double y);
    virtual void writeMatlabDisplayCode(std::ostream &fs);
    virtual ~Obstacle(){}
};
#endif

What’s the problem I have ? I can post any code you need to analyze it.

  • 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-12T19:44:12+00:00Added an answer on May 12, 2026 at 7:44 pm

    You declare a non-abstract class Obstacle, but you don’t implement all its member functions.

    Better declare it as abstract class:

    class Obstacle{
    public:
        Obstacle(){} // this is superfluous, you can (and should) remove it
        virtual bool collidesWith(double x,double y) = 0;
        virtual void writeMatlabDisplayCode(std::ostream &fs) = 0;
        virtual ~Obstacle(){}
    };
    

    The reason is a heuristic you’ll find in many C++ compilers – to avoid the needless creation of duplicate vtables and typeinfos for a class they are created when its first non-inline virtual member function (if it has one) is defined.

    Your code foils this scheme: You include Obstacle.hh into some compilation unit, the compiler sees a class Obstacle that has collidesWith as first non-inline virtual member function, but it isn’t defined in the current compilation unit, so the compiler thinks it can defer the creation of vtable and typeinfo for the class. Because there is no definition of collidesWith, they both end up missing when the program is linked.

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

Sidebar

Related Questions

I started using Zend_Paginator, it works everything fine but I noticed that there is
Everything works fine, the only problem is that it loads very slow. It takes
Until yesterday everything was fine to my localhost, but starting yesterday, localhost is not
Everything works fine. My code as below copied from Google's guide. My problem is,
I started a Rails app and everything works fine. But now, I would like
Some time ago i've made a simple dialog. Everything looks fine, but i'm meeting
I have a problem implementing Oauth in Android using signpost library. Everything is fine
i implemented a listview which implements SectionIndexer ... everything fine so far. Normally the
Everything's fine building in xcode and testing the app until I built in for
Everything works fine locally when I do as follows: cat input | python mapper.py

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.