views:

80

answers:

3

In visual studio 2008, I have created a static dll called test_static.dll. I am trying to call this from one application. I have included this dll in source files folder and the header file related to it in headers folder. When i am running the application I am getting following liking error. Please give me a solution.

error LNK2019: unresolved external symbol "struct morph_output * __cdecl morpho_data(struct morph_input *)" (?morpho_data@@YAPAUmorph_output@@PAUmorph_input@@@Z) referenced in function _wmain 1>D:\test_app\Debug\test_app.exe : fatal error LNK1120: 1 unresolved externals 1>Build log was saved at "file://d:\test_app\test_app\Debug\BuildLog.htm"

Here test_app is application that is using static dll. and morpho_data is the dll function which is taking input as structure and returning another structure.

A: 

When compiling the dll you need to create an import library - a .lib file (Linker->Advanced->Import Library) and include it into the list of libraries your .exe depends on (Linker->Input->Additional Dependencies and Linker->General->Additional Library Directories).

sharptooth
A: 

Did you add test_static.lib as input to the linker in the project settings?

Ralph
A: 

Did you include the header file where the function is declared ?

sameer karjatkar
If he didn't include that he would see an error during source compiling, not linking.
sharptooth
@sharptooth that deserves a down vote . Please can you oblige ?
sameer karjatkar