?
Solved

QSort Compare Function LNK2001 Unresolved External Symbol Error

Posted on 2005-02-24
3
Medium Priority
?
414 Views
Last Modified: 2012-06-22
Hi,

I'm quite new to using Qsort function. Have encountered problem with this error

error C2664: 'qsort' : cannot convert parameter 4 from 'int (const void *,const void *)' to 'int (__cdecl *)(const void *,const void *)'

but managed to get everything work out after changing my compare function to say

int cmp(const *ptr1,const *ptr2) through the help of Nietod's advice found at
http://www.experts-exchange.com/Programming/Programming_Languages/Cplusplus/Q_10140748.html

However, right now i'm encountering the above mentioned error. The error is as follow

qsorting.obj : error LNK2001: unresolved external symbol "int __cdecl cmp(void const *,void const *)" (?cmp@@YAHPBX0@Z)
Debug/PROGRAM.exe : fatal error LNK1120: 1 unresolved externals

what have i gone wrong ? Been debugging it for the day. just cant get anything working. Does anyone has a working experience on this ? Kind advice needed and tks a million!


0
Comment
Question by:ricola
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 48

Expert Comment

by:AlexFM
ID: 13391884
Please show your code.
0
 
LVL 30

Accepted Solution

by:
Axter earned 320 total points
ID: 13391902
Hi ricola,
>> nt cmp(const *ptr1,const *ptr2)
It's missing the type.

It should have a type like the following:
int cmp(const void*ptr1,const void*ptr2)
0
 
LVL 1

Author Comment

by:ricola
ID: 13392124
Axter you are absolutely correct ! Was about to post my code until i saw your msg. Gosh this small mistake kill hours of my time.

Thanks a million!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question