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 7585489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:11:19+00:00 2026-05-30T19:11:19+00:00

I have a program in xcode and had the thing running fine with just

  • 0

I have a program in xcode and had the thing running fine with just the skeleton. I went to add some code in and when I added three functions, all private, two of which are inline to both the .h and .cpp. When I went to compile I got linker errors for god knows what reason. The class I am making functions in also inherits from a struct but i dont think that should be a problem. Ill post the code below. (there’s a lot to this project so i cant post everything)

#ifndef HEAP_SORT_H
#define HEAP_SORT_H

#include "Interfaces02.h"
#include "CountedInteger.h"

class HeapSort : public IHeapSort {
public:
HeapSort();
virtual ~HeapSort();
virtual void buildHeap(std::vector<CountedInteger>& vector);
virtual void sortHeap(std::vector<CountedInteger>& vector);
private:
virtual unsigned int l(int i);
virtual unsigned int r(int i);
virtual void fixDown(std::vector<CountedInteger>& vector, int p);
};

#endif


#include "HeapSort.h"
#include "CountedInteger.h"

HeapSort::HeapSort()
{
}

HeapSort::~HeapSort()
{
}

void HeapSort::buildHeap(std::vector<CountedInteger>& vector)
{    

int i = ((int) vector.size()) - 1;
for(; i > 1; i--)
{
    fixDown(vector, i);
}


}

void HeapSort::sortHeap(std::vector<CountedInteger>& vector)
{
}

inline unsigned int l(int i)
{
return ((i*2)+1);
}

inline unsigned int r(int i)
{
   return ((i*2)+2);
}

void fixDown(std::vector<CountedInteger>& vector, int p)
{

int largest;

if(l(p) <= vector.size() && vector[l(p)] > vector[p])
   {
       largest = l(p);
   }
   else
   {
       largest = p;
   }
if(r(p) <= vector.size() && vector[r(p)] > vector[p])
   {
       largest = r(p);
   }
if(largest != p)
{
    CountedInteger temp = vector[largest];
    vector[largest] = vector[p];
    vector[p] = temp;
    fixDown(vector, largest);
}


}

and here is the error its giving me:

Undefined symbols for architecture x86_64:
"HeapSort::l(int)", referenced from:
vtable for HeapSort in HeapSort.o
  "HeapSort::r(int)", referenced from:
  vtable for HeapSort in HeapSort.o
  "HeapSort::fixDown(std::vector<CountedInteger,std::allocator<CountedInteger>>&,int)", 
 referenced from:
  vtable for HeapSort in HeapSort.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
  • 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-30T19:11:20+00:00Added an answer on May 30, 2026 at 7:11 pm

    You’re not implementing:

    virtual unsigned int l(int i);
    virtual unsigned int r(int i);
    virtual void fixDown(std::vector<CountedInteger>& vector, int p);
    

    You forgot to qualify these methods in the implementation file.

    inline unsigned int l(int i)
    

    is not the same as

    inline unsigned int HeapSort::l(int i)
    

    As they are now, they’re just free functions defined in that translation unit.

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

Sidebar

Related Questions

I JUST started a new XCode Project. The code I have added in so
I have just added a provisioning profile to XCode (needed to support notifications and
I have Xcode 4.3 and it works fine. However, running make to compile a
I have a program 'foo' running different threads, fooT1, fooT2, .. fooTn. Now if
I have this bizarre problem. I'm making a checklist program with XCode and I'm
I have code coverage in XCode 4.2 with libprofile_rt working. I have noticed that
I am solving my C assignment in Xcode and in that program i have
I am debugging an Iphone program with the simulator in xCode and I have
While debugging a program in Xcode I have several CFStringRef variables that point to
Suppose I have written a little program by Xcode 4, how can I test

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.