Click here to Skip to main content
15,883,917 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all,

I have a Library-Project with a .def file. (I use Visual Studio 2010)
I included this project in a solution with an .exe Projects, which should use this .lib.

But when i try to use a function of the lib, i get a linker-error: external Symbol (LNK1120).

This means it cannot find the function.... why?

- i set all dependecies, included the Header with the exported functions in the .exe Project.

I think now, it is possibly something wrong with the .def file:

the important part of the .def file:

EXPORTS
ZpArchive
ZpVersion
ZpInit
ZpSetOptions
ZpGetOptions

which are the functions, the .lib Project should Export.
Do i have to write the argements of the functions too (i didnt write this .def file)? or is this the right way?


thanks for any help..
Posted

If you get linker errors then it means your def file is incomplete, see http://msdn.microsoft.com/en-gb/library/d91k01sh.aspx[^].
 
Share this answer
 
When you use a LIB you should compile it and place it under a directory of the source of the project that will use it.

Then remember to go in the project properties and set the dependency by the library.

For example if your library is called myZip.lib you should go in the project properties of the project using the lib, under Linker->Input add in the "Additional dependecies" the name of the lib, i.e "myZip.lib".

Mind the relative path with respect to the Project dir, it might need one or two tries the first times.

Hope that helps,
Denis


EDIT: as always I read too fast and misse some points, forgive me.

Which functions does it misses? Are the exported functions declared as __stdcall? It might need that in order to work.
 
Share this answer
 
v2
Comments
den2k88 19-Nov-14 3:52am    
http://support.microsoft.com/kb/815650

This solution does exactly the same as putting the correct path in Additional Dependencies
Member 10781325 19-Nov-14 4:37am    
yes, the functions use __stdcall.
it is a c-library, i am using c++, i put now extern "c" { api.h}
(this is the Header include for the imported functions of the .lib)
now i get some other (~20) link-Errors:

msvcrtd.lib(MSVCR100D.dll) : error LNK2005: _printf already defined...

i think These are configurations in the Project...

thank you for ur Responses!!!! you put me on the right way
Member 10781325 19-Nov-14 5:30am    
ok, Problem is solved!:-)

i had to write externc , when i included the c-Header of the .lib Project in my c++ application

thank you all guys!:-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900