Importing dll's into vc++(error LNK2001 Undefined External Symbol)
The best part of this problem is I did not know the error LNK2001 Undefined externals was problem with importing Dll's.So this title is a special one.
Yes Identifying the problem solves most of the problem thaks to Google!!!
Thanks to the post
http://www.codeproject.com/dll/XDllPt1.asp
I got this linkage error LNK2001 when I was trying to link a library to be used in my code.Most of it were API calls to that library.I tried to include in
Tools->Options->Directories
and had included all necessary libs,includes and executables...but it was still
Om 'Bug'aaya namaha
I was sitting on this problem and well out of the blue the word Dll crept into me...how
no idea....God must have sympathised.So just searched for importing dlls into vc++
and Bingo I came across this post.
So if u want to link Dll's do following
i)Make sure all includes are correct i.e
Go to Tools->Options->Directories
Under Include Files give include path..something like e:\MyDir\Include Under Library Files give include path..something like e:\MyDir\bin
Under Executables give include path..something like e:\MyDir\bin
ii)Go to Project->Settings->Link
Under Object/Library Modules
Enter path of the library like e:\MyDir\bin\My_lib.lib
iii)Go to Project->Settings->c/c++
Category:Preprocessor
Under Additonal Include Directories give path of directory e:\Mydir\bin
where ur Dll,Lib etc are dumped
iv)Copy the .dll file into the Debug folder of ur project
Rebuild All and yep it works
Yes Identifying the problem solves most of the problem thaks to Google!!!
Thanks to the post
http://www.codeproject.com/dll/XDllPt1.asp
I got this linkage error LNK2001 when I was trying to link a library to be used in my code.Most of it were API calls to that library.I tried to include in
Tools->Options->Directories
and had included all necessary libs,includes and executables...but it was still
Om 'Bug'aaya namaha
I was sitting on this problem and well out of the blue the word Dll crept into me...how
no idea....God must have sympathised.So just searched for importing dlls into vc++
and Bingo I came across this post.
So if u want to link Dll's do following
i)Make sure all includes are correct i.e
Go to Tools->Options->Directories
Under Include Files give include path..something like e:\MyDir\Include Under Library Files give include path..something like e:\MyDir\bin
Under Executables give include path..something like e:\MyDir\bin
ii)Go to Project->Settings->Link
Under Object/Library Modules
Enter path of the library like e:\MyDir\bin\My_lib.lib
iii)Go to Project->Settings->c/c++
Category:Preprocessor
Under Additonal Include Directories give path of directory e:\Mydir\bin
where ur Dll,Lib etc are dumped
iv)Copy the .dll file into the Debug folder of ur project
Rebuild All and yep it works