dll import 1




int SayRunTimeDLL(int a, int b)
{
int c=a+b;
return c;
}


This is a function in my Dll file RunTimeDLL.dll located at C:\New Folder

HEre is my CPP file, in a totally new project in which m trying to import dis RunTimeDLL.dll but i am not able to. its Generating error.


------------------------------
Error 1 error LNK2019: unresolved external symbol "__declspec(dllimport) int __cdecl SayLoadTimeDLL(int,int)" (__imp_?SayLoadTimeDLL@@YAHHH@Z) referenced in function _main C:\Users\user\Documents\Visual Studio 2010\Projects\test111\test111\test111.obj

Error 2 error LNK1120: 1 unresolved externals C:\Users\user\Documents\Visual Studio 2010\Projects\test111\Debug\test111.exe 1

-------------------------------
test111.CPP file code


#include<Windows.h>
#include<iostream>


using namespace std;
//#import "C:\New Folder\LoadTimeDLL.dll"
//#define dllimport
extern __declspec(dllimport) int SayRunTimeDLL(int, int);

void main()
{
cout<<SayRunTimeDLL(42,12);
}


----------------------------------------------------------

Please somebody help me with this and tell me what this error is exactly and how to resolve it??
I don't see a #pragma comment(lib "yourlibfiletolinkyourdll.LIB") line. You need one. Usually the compiler creates one for you when you compile your dll, but if not you can generate it afterwards. Here's one article you might like: http://support.microsoft.com/kb/131313
heyy thnx man... but i had already found d need to use this macro... thnx to google... but thnx agn anyway.. :)
Topic archived. No new replies allowed.