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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:02:34+00:00 2026-05-18T00:02:34+00:00

Sorry for my bad English. I have 2 projects. Project 1 is a MFC

  • 0

Sorry for my bad English. I have 2 projects. Project 1 is a MFC dll that contains class CMyContainer, class CEmployee. Project 2 is my main project. In project 2, I created an instance of CMyContainer of type CEmployee. Now I want to sort the container but I got an error

“error LNK2019: unresolved external symbol "bool __cdecl MyComparer(class CEmployee *,class CEmployee *)" (?MyComparer@@YA_NPAVCEmployee@@0@Z) referenced in function "public: void __thiscall CMyContainer<class CEmployee>::sortContainer(void)" (?sortContainer@?$CMyContainer@VCEmployee@@@@QAEXXZ)“

How can I fix this problem?

// file MyContainer.h in project 1

#include <vector>

template <class T> 
class _declspec(dllexport) CMyContainer
{
public:
    CMyContainer(void);
    ~CMyContainer(void);
        ...

    void sortContainer(); 
private:
    std::vector<T*> items;  
    typename std::vector<T*>::iterator it;
};
template <class T> void CMyContainer<T>::sortContainer()
{
    typedef bool (*comparer_t)(T*,T*);
    comparer_t cmp = &MyComparer;
    std::sort(items.begin(), items.end(), cmp);
}


//File Employee.h in project 1
#include "MyContainer.h"


class _declspec(dllexport) CEmployee
{
public:
    CEmployee(void);
    ~CEmployee(void);
        void setEmployeeCode(CString);
        CString getEmployeeCode();
        friend bool MyComparer(CEmployee*, CEmployee*);
private:
        CString m_szEmployeeCode;
}

//File Employee.cpp in project 1
void CEmployee::setEmployeeCode(CString val){
    m_szEmployeeCode= val;
}


CString CEmployee::getEmployeeCode(){

    return  m_szEmployeeCode;
}
bool MyComparer(CEmployee*pEmp1, CEmployee*pEmp2)
{
    return (pEmp1->getEmployeeCode().Compare(pEmp2->getEmployeeCode())<0);
}
//File main.cpp in project 2
#include <..\Models\MyContainer.h>
#include <..\Models\Employee.h>
...
CMyContainer<CEmployee> *pListEmployee;
... // insert into pListEmployee
// sort pListEmployee
pListEmployee.sortContainer();//-> This command cause error
  • 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-18T00:02:34+00:00Added an answer on May 18, 2026 at 12:02 am

    Try to export MyComparer from the .dll with _declspec(dllexport)

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

Sidebar

Related Questions

Sorry for my bad English. Just like what I asked. I have this class
first, sorry for the bad english. I have a test that submit a login
Sorry for bad english and bad title! I have the table post id title
First, sorry for my bad english, I'm French. Here the problem : I have
i have project in ASP.NET MVC 3 and a mysql database that contains a
Sorry for my bad English. I have two activity. called Act1 and Act2 Act2
Sorry for my bad english, i'm from Italy XD I have done frogger game
At first sorry for bad english, Im deafinitely not specialized into math-english. I have
Sorry for bad English :( Suppose i can preliminary organize recipes and ingredients data
At first sorry my bad English. I want define routing for this url: For

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.