Why my classes are not linked?

I want to create a custom Node class. I subclass PandaNode in a new MyNode.h and MyNode.cxx:

#include "pandaNode.h"

class EXPCL_PANDA_PGRAPH MyNode : public PandaNode {

PUBLISHED:
	MyNode(std::string name);
public:
	~MyNode();
};
#include "MyNode.h"

MyNode::MyNode(std::string name):PandaNode(name){}
MyNode::~MyNode() {}

This node doesn’t really do anything. I just want to see if I am doing it right.

After I rebuild Panda (I use cmake branch btw), in the new project I include the MyNode.h and write:

MyNode* mn = new MyNode();

But linker doesn’t see my class:

LNK2001	unresolved external symbol "__declspec(dllimport) public: virtual __cdecl MyNode::~MyNode(void)" (__imp_??1MyNode@@UEAA@XZ)

LNK2001	unresolved external symbol "__declspec(dllimport) public: __cdecl MyNode::MyNode(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (__imp_??0MyNode@@QEAA@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)	

I am a C++ noob, so maybe it’s a simple thing that I don’t understand.

EDIT:

This has nothing to do with macros, but with build system.

OK. I fugiured it out. But still can’t make it work.

Macro EXPCL_PANDA_PGRAPH expands to __declspec(dllexport) if BUILDING_PANDA_PGRAPH is defined. And it is defined.

From what I expect my class to be exported to libpanda.dll.

Then, when I use my header outside of Panda3D project, BUILDING_PANDA_PGRAPH is not set, and macro EXPCL_PANDA_PGRAPH expands to __declspec(dllimport). From what I am expecting it to import my class from libpanda.dll. But this doesn’t happen. I am confused.

EDIT: I’ve managed to solve it. Just needed to edit CmakeLists.txt for all the projects I was adding files to. EXPCL_* macros work as they expected.