|
-
August 7th, 2003, 11:31 AM
#1
Problem on Linking extern variables
Hi,
I have problem on linking an extern variable.
My code is look like as follows.
My dll contains the following code
DllTest.h
-----------
#include <iostream>
namespace Test
{
__declspec(dllexport) extern int* i;
}
DllTest.cpp
--------------
#include "DllTest.h"
namespace Test
{
__declspec(dllexport) int *i = NULL;
}
If i make a dll with above code it is done.
When i am linking this dll with my Test program it gives the error
error LNK2001: unresolved external symbol "int * Test::i" (?i@Test@@3PAHA)
My Test Program for this dll is
#include <DllTest.h>
void main()
{
if (Test::i == NULL)
{
printf("Null");
}
else
{
printf("Not Null");
}
}
If anybody gives solution i am very much happy......
thanks in advance
Regards
Manikandan
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|