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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:22:55+00:00 2026-06-08T19:22:55+00:00

I should preface this by saying that I am an undergrad CS student with

  • 0

I should preface this by saying that I am an undergrad CS student with little to no knowledge of how compilers work. To me these errors look like complete gibberish, and after scouring the web for about half an hour, I’m afraid I’ve resigned myself to asking for help =(

here are the errors I’m receiving:

Prog4Main.obj : error LNK2019: unresolved external symbol “void __cdecl shellSort(struct SortData * const,int)” (?shellSort@@YAXQAUSortData@@H@Z) referenced in function _main

*\Debug\prog4 again.exe : fatal error LNK1120: 1 unresolved externals

These are the only two errors I’m getting.

So, onto what my program is trying to accomplish:

This is a homework assignment in my c++ class. We have to implement 5 of the sorting algorithms shown to us in class. I have implemented bubble sort and insertion sort just fine, but shell sort is giving me these errors. they are in the same .cpp file, and i have no compile errors when i comment out the shellSort() function call.

As it is reaching the end of my summer semester c++ class and we didn’t have enough time to cover sort algorithms in depth, the instructor pretty much gave us all code for this program. we just have to change variable names and tweak the form of the sort functions to suit our needs. because of this, I know all my code is correct, as I didn’t write it.

This is in VS2010 (not express, I think its ultimate), my application is a win32 console application, and I’ve checked and insured that user32.lib is linked (as it was mentioned in one of the other link error posts). I seriously have no idea how to resolve this problem….

heres the problem code:

//---------------------- Begin Shell Sort -----------------------
    totalTime = 0.0; // Initialize the time variable
    sortError = false; // Initialize the error flag
    // For each of 5 runs on this algorithm
    for(int i=0; i<5; i++)
    {
        // Read the data.  You must do this before each sort
        if(!ReadData(DataArray, NUMRECS))
        {
            cout << "Failed to read data file.\n Program Terminated\n";
            return 0;
        }
        // Start the microsecond timer
        mst->Start();

        shellSort(DataArray, NUMRECS);// Call the sort function here PROBLEM SPOT

        // Stop the microsecond timer
        mst->Stop();
        // Check for error in sorting
        if(!CheckData(DataArray, NUMRECS))
            sortError = true;
        else
            totalTime += mst->getTime(); // Add to the total time for this sort
    }
    // Calculate the average time
    averageTime = totalTime / 5.0;

    // Output the results after checking to be sure the sort worked
    if(sortError)
        cout << "Error in Shell Sort\n\n";
    else
        cout << "Shell sort took " << averageTime << " seconds to complete\n\n";
    //------------------------ End Shell Sort -----------------------------

Any help you guys can give is much appreciated.

EDIT: heres the prototype and function def…

    #define NUMRECS 10000

void shellSort(SortData DataArray[NUMRECS], int count); int main{...} //---------------------SHELL SORT------------------------ void ShellSort(SortData DataArray[], int count) { int i, delta; delta = count; do { delta = 1 + delta / 3; for(i=0; i<delta; i++) DeltaInsertionSort(DataArray, i, delta, count); } while(delta > 1); } void DeltaInsertionSort(SortData DataArray[], int I, int Delta, int count) { int j, k; int key; int NotDone; SortData temp; j = I + Delta; while(j < count) { key = DataArray[j].key; /* Get next key to sort */ temp = DataArray[j]; /* Remove and hold */ /* Do insertion sort on this key in the block of delta records */ /* Move each struct where DataArray[j].key > key to the right */ /* by delta spaces and insert the key there. */ insertion(DataArray, key); k = j; NotDone = TRUE; do { if(DataArray[k - Delta].key <= key) NotDone = FALSE; /* Terminate the loop */ else { DataArray[k] = DataArray[k - Delta]; k -= Delta; if(k==I) NotDone = FALSE; } } while(NotDone); /* Insert the moved key */ DataArray[k] = temp; /* Get next key to insert--one full delta increment to the right */ j += Delta; } }

  • 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-06-08T19:22:56+00:00Added an answer on June 8, 2026 at 7:22 pm

    C++ is case-sensitive: shellSort vs ShellSort. You’ve declared and called one function, but implemented a completely unrelated function!

    The reason this is a linker error rather than a compiler error, is that the forward declaration tells the compiler “there’s going to be a definition of this function shellSort somewhere”, but doesn’t specify where. Since it’s not in this .cpp file, the compiler takes your word for it that it must be in a different .cpp file that will be linked together with this .cpp file later. When you get to the linking stage, there’s still no function shellSort.

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

Sidebar

Related Questions

I should preface this question by saying that I am new to JavaServer Pages.
Let me preface this by saying I have no knowledge of Java. I am
BACKGROUND: I should preface this by saying I'm not trying to get someone to
First off, let me preface this question by saying that my professor is firmly
I should preface this by saying I'm working on a pocket PC app and
I should preface this question by saying I think the answer is probably no,
I want to preface this question with the fact that I am a student
I want to preface this by saying that this is a homework assignment. I
Let me preface this question by saying that I am a .NET developer at
To preface this question I should say I know very little about database efficiency

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.