Unresolved External Symbol

F

Freddy

I am not an experienced programmer, but I had a VC++ program I am
trying to eliminate all the VC++ commands from it...and keeping it as
a normal C/C++ program......I guess I have succeeded so far, but I am
getting the unresolved external symbol errors, this is what I am
getting:


Linking...
Test.obj : error LNK2001: unresolved external symbol "void __cdecl
free_vector(double *)" (?free_vector@@YAXPAN@Z)
Test.obj : error LNK2001: unresolved external symbol "double * __cdecl
resize(double *,unsigned int)" (?resize@@YAPANPANI@Z)
Test.obj : error LNK2001: unresolved external symbol "double __cdecl
fmax(double * const)" (?fmax@@YANQAN@Z)
Test.obj : error LNK2001: unresolved external symbol "double * __cdecl
Derivs(double,double * const,double * const,unsigned short,char *
const)" (?Derivs@@YAPANNQAN0GQAD@Z)
Test.obj : error LNK2001: unresolved external symbol "double * __cdecl
dvector(unsigned int)" (?dvector@@YAPANI@Z)
Test.obj : error LNK2001: unresolved external symbol "double * __cdecl
Derivs(double,double * const,double * const,unsigned short)"
(?Derivs@@YAPANNQAN0G@Z)
Debug/Test.exe : fatal error LNK1120: 6 unresolved externals
Error executing link.exe.

Test.exe - 7 error(s), 0 warning(s)

Please help, not sure what is the problem. what could be the solution.
 
V

Victor Bazarov

Freddy said:
I am not an experienced programmer, but I had a VC++ program I am
trying to eliminate all the VC++ commands from it...

What does that mean, exactly? You're still compiling it using VC++...
and keeping it as
a normal C/C++ program......I guess I have succeeded so far, but I am
getting the unresolved external symbol errors, this is what I am
getting:


Linking...
Test.obj : error LNK2001: unresolved external symbol "void __cdecl
free_vector(double *)" (?free_vector@@YAXPAN@Z)
Test.obj : error LNK2001: unresolved external symbol "double * __cdecl
resize(double *,unsigned int)" (?resize@@YAPANPANI@Z)
Test.obj : error LNK2001: unresolved external symbol "double __cdecl
fmax(double * const)" (?fmax@@YANQAN@Z)
Test.obj : error LNK2001: unresolved external symbol "double * __cdecl
Derivs(double,double * const,double * const,unsigned short,char *
const)" (?Derivs@@YAPANNQAN0GQAD@Z)
Test.obj : error LNK2001: unresolved external symbol "double * __cdecl
dvector(unsigned int)" (?dvector@@YAPANI@Z)
Test.obj : error LNK2001: unresolved external symbol "double * __cdecl
Derivs(double,double * const,double * const,unsigned short)"
(?Derivs@@YAPANNQAN0G@Z)
Debug/Test.exe : fatal error LNK1120: 6 unresolved externals
Error executing link.exe.

Test.exe - 7 error(s), 0 warning(s)

Please help, not sure what is the problem. what could be the solution.

The solution would be to provide the definitions of those functions
during the linking stage of building your project. As to where they
come from, or how to add them to the project, sorry, off-topic here.

Try asking in a newsgroup for VC++: microsoft.public.vc.* hierarchy.

Victor
 
K

Kutty Banerjee

Freddy said:
I am not an experienced programmer, but I had a VC++ program I am
trying to eliminate all the VC++ commands from it...and keeping it as
a normal C/C++ program......I guess I have succeeded so far, but I am
getting the unresolved external symbol errors, this is what I am
getting:


Linking...
Test.obj : error LNK2001: unresolved external symbol "void __cdecl
free_vector(double *)" (?free_vector@@YAXPAN@Z)
Test.obj : error LNK2001: unresolved external symbol "double * __cdecl
resize(double *,unsigned int)" (?resize@@YAPANPANI@Z)
Test.obj : error LNK2001: unresolved external symbol "double __cdecl
fmax(double * const)" (?fmax@@YANQAN@Z)
Test.obj : error LNK2001: unresolved external symbol "double * __cdecl
Derivs(double,double * const,double * const,unsigned short,char *
const)" (?Derivs@@YAPANNQAN0GQAD@Z)
Test.obj : error LNK2001: unresolved external symbol "double * __cdecl
dvector(unsigned int)" (?dvector@@YAPANI@Z)
Test.obj : error LNK2001: unresolved external symbol "double * __cdecl
Derivs(double,double * const,double * const,unsigned short)"
(?Derivs@@YAPANNQAN0G@Z)
Debug/Test.exe : fatal error LNK1120: 6 unresolved externals
Error executing link.exe.

Test.exe - 7 error(s), 0 warning(s)

Please help, not sure what is the problem. what could be the solution.
Hi,
I agree with the earlier post that this is out of topic and moreso need
soem more information, but my immediate guess is that you are calling c++
functions from a C program without doing #ifdef __cplusplus stuff. Do that.
another thing that could go wrong is the calling convention. make sure
you are sticking to one properly and not mixing between them.

kutty
 
Joined
Nov 18, 2009
Messages
1
Reaction score
0
In the header file for C files (ANSI C), add the following
prior to and after function prototypes.

#ifdef __cplusplus
extern "C"
{


#ifdef __cplusplus
}
#endif

This cured my particular problem which rendered this link error.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top