static menber pointer to member function - LNK2001 error
- From: "DnKelly" <DnKelly@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 8 Nov 2005 17:38:06 -0800
For some reason the code below will not link using the .NET linker. I get a
LNK2001 error: unknown external.
The wierd part is that if I remove LINE A, it compiles fine, with the LINE
C implemented in header file and LINE D commented out. If I remove LINE A,
and comment out implementation of LINE C, and use the implementation at LINE
D, it won't compile. It doesn't like LINE B, and doesn't seem to call for a
definition outside of the class, like most static members.
Help.
#include "Tester.h"
main(){
Tester testerx;
testerx.test(); /////////////LINE A
};
Tester.h:
===========
#include "xyz.h"
//int xyz::*p; /////////////////LINE B
class Tester{
public:
//constructor
Tester();
~Tester();
void test(){xyz::p=testX::geti;}//////////LINE C
};
Tester.cpp:
===================
#include "Tester.h"
Tester::Tester(){};
Tester::~Tester(){};
//void Tester::test(){xyz::p=testX::geti;}; /////////////LINE D
xyz.h:
=====================
#include "testx.h"
class xyz
{
public:
xyz(void);
~xyz(void);
static int (testX::*p)(); ////////////LINE E
};
xyz.cpp:
=======================
#include "xyz.h"
xyz::xyz(void){}
xyz::~xyz(void){}
testx.h:
======================
class testX{
public:
int i;
int geti();
void seti(int);
testX(){};
};
testx.cpp:
===================
#include "testx.h"
int testX::geti(){return i;}
void testX::seti(int ii){i=ii;}
.
- Follow-Ups:
- Re: static menber pointer to member function - LNK2001 error
- From: Igor Tandetnik
- Re: static menber pointer to member function - LNK2001 error
- Prev by Date: Re: .NET
- Next by Date: Re: static menber pointer to member function - LNK2001 error
- Previous by thread: Re: Passing array to function
- Next by thread: Re: static menber pointer to member function - LNK2001 error
- Index(es):
Relevant Pages
|