Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A simple question

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
hi,
I got some error like
ezrgb24.obj : error LNK2001: unresolved external symbol "void __stdcall init_dct_NxM(int,int)" (?init_dct_NxM@@YGXHH@Z)
ezrgb24.obj : error LNK2001: unresolved external symbol "void __stdcall init_dct_NxN(int,int)" (?init_dct_NxN@@YGXHH@Z)
.\Debug\ezrgb24.ax : fatal error LNK1120: 2 unresolved externals

bascially, I am trying to calling a C function from a C++ module, and the C++ module include the header file of the C fuctions, and I changed the .h file, so that those funciton are "extern", and wondering if anybody can tell me what's missing?

thanks

SydC++
 
You have the function prototypes included from the .h file, but do you have the functions themselves in the .c file included in your project? The error is saying that it can't find the function init_dct_NxN(). You need to make sure that its source code is included in your project, or if it's from a library, that the library is included in your link list of libraries.
 
Also try including the function headers in the .cpp file. I had a similar problem and when I included the functions headers in the C++ file, it subsided. You also have the include the .h file corresponding to your libraries of "C" functions .
 
The easiest is to rename your function implementation file from .c to .cpp.

If this is not feasible, try enclose the function defintion with:
Code:
extern "C"
{
    /* put function defintion here */
    ...
}
HTH
Shyan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top