Sign in to follow this  

code compiles fine... but has build error

This topic is 3151 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

error LNK2019: unresolved external symbol "void __cdecl sortDescendName(struct Contestant * const,double)" (?sortDescendName@@YAXQAUContestant@@N@Z) referenced in function _main I don't get what the error here means.. here is the declaration of the function and the function call in case I screwed something up there. declaration: void sortDescendName(Contestant[], double); function call: sortDescendName(cont, numbcont); thanks for the help :]

Share this post


Link to post
Share on other sites
This error means that you are calling a function, but you never actually provided any code for that function to the compiler. If this is a function you meant to write yourself, double-check that you have in fact written it and that it is named the same thing as in your function prototype. (Also ensure there are the same number of parameters and that the parameters are of the same types.)

If this function is from a library, double check your project settings and ensure that the correct .lib file is referenced by the linker.

Share this post


Link to post
Share on other sites
i figured it out
i had declared numbcont as an int
and in teh fuction definition it was a double
not sure why the compiler didn't pick it up
thanks tho!

Share this post


Link to post
Share on other sites
Function definition is declaration in most cases. So if you declare a function which takes a double yet define it to take an int, then the compiler will look at your definition and think you are trying to define an overloaded function that takes an int. So then it will say (when linking) that there is no definition for the double one.

Share this post


Link to post
Share on other sites
Quote:
Original post by neipo13
i figured it out
i had declared numbcont as an int
and in teh fuction definition it was a double
not sure why the compiler didn't pick it up
thanks tho!


It doesn't matter if that's how you call the function, because int is implicitly converted to double. It does matter if that's how you define the function, because your definition must match the declaration (otherwise it's defining something else).

Usually when you get an error like this, it's because you're not #including the header that declares the function, or don't have the .cpp file that defines it in the project.

Share this post


Link to post
Share on other sites

This topic is 3151 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this