Hi, I am currently having a problem regarding an extern class variable declaration and definition.

I have a qt subdirs project composed of several projects. The other projects have a config as dynamiclib as they are to be loaded as dlls in the application.

I am implementing a facade class that loads the dlls dynamically and I assign them to qwidgets. To use the instances, I just created a function that returns the desired widget.

Ive declared it this way.

Facade.h

class CFacade
{
public:
QWidget* get_instance_ptr(int i);

private:
QWidget *widget1;
QWidget * widget2;

};
extern CFacade FacadeObj;


Facade.cpp

I defined the extern variable here..
CFacade FacadeObj;



In my subdirs project, with a general form:

subdirs1.pro\
subdirs2.pro\
subdirsmain.pro

subdirs1 has the facade class, since in the build order, it should be built first in order for the other projects
to access the same extern facade class variable.

I want to use the extern facade var in subdirsmain so I just declare the header in one of my cpps that use it but it gets an error that the extern facade class var is an undefined reference. could anyone give some inputs as to what causes this?