Undefined reference to vtable with TTree::MakeSelector

Hi all,
I used MakeSelector to automatically generate a .C and .h file using a command like the following:
root [#] h42->MakeSelector(“myselector”)

After generating my .C and .h file, I attempted to compile the class into an executable with g++
Here is my simple code for that:

[code]#include
#include
#include
#include

#include “SMWZ.h”

using namespace std;

int main(int argc, char *argv[])
{

SMWZ();

return 0;
}[/code]

Before running that code, I changed SMWZ.h so that vector became std::vector and string became std::string

Then, I attempted to compile using the following makefile

[code]all: ZJet

ZJet: ZJet.o
g++ -O3 -ffast-math -funroll-loops -ansi root-config --libs -o ZJet ZJet.o

ZJet.o: ZJet.cpp
g++ -O3 -ffast-math -funroll-loops -ansi root-config --cflags -c -o ZJet.o ZJet.cpp[/code]

The exact error message I am getting is:
g++ -O3 -ffast-math -funroll-loops -ansi root-config --libs -o ZJet ZJet.o
ZJet.o: In function main': ZJet.cpp:(.text+0x47): undefined reference tovtable for SMWZ’
collect2: ld returned 1 exit status
make: *** [ZJet] Error 1

If this is relevant, all of this was done using ROOT 5.28 and gcc4

Hi,

What is the relationship if any between ‘myselector’ and SMWZ? Did you generate compile and link a dictionary for SMWZ? What is the relationship if any between SMWZ and ZJet.cpp? It seems that the issues is simply that the code for SMWZ has not been compiled and linked in with the executable.

Philippe.