<Maybe very noob question>TextureRef throw error - use with extern

hello
At first, Like simply:

a.h
#include <cinder/app/App.h>
#include <cinder/app/RendererGl.h>
#include <cinder/gl/gl.h>

class a
{
public:
ci::gl::TextureRef texture;
ci::gl::GlslProgRef glsl;
ci::gl::BatchRef batch;
public:
a();
public:
void loadTexture();
};

a.cpp
#include <cinder/app/App.h>
#include <cinder/app/RendererGl.h>

#include “a.h”

using namespace ci;
using namespace ci::app;
using namespace std;

a::a()
{
loadTexture();
}
void a::loadTexture()
{
auto texture = gl::Texture::create(loadImage(loadAsset(“earth.jpg”)));
auto shader = gl::ShaderDef().texture().color();
glsl = gl::getStockShader(shader);
}

Global.h
#pragma once

#include “a.h”

extern a GlobalClass;

main.cpp

#include <cinder/app/App.h>
#include <cinder/app/RendererGl.h>
#include <cinder/gl/gl.h>

#include “Global.h”

a GlobalClass;
class main : public ci::app::App
{
public:
static void prepareSettings(Settings* settings);
void setup() override;
//never using this:
void keyDown(ci::app::KeyEvent event) override;
void draw()override;
};

void main::setup()
{
GlobalClass = a();
}

//functions//

CINDER_APP(main, ci::app::RendererGl(ci::app::RendererGl::Options().msaa(16)))


When I start debugging, stop this and display _**Context.cpp**_
 and this code:

void Context::textureCreated( const TextureBase *texture )
{
	if( mObjectTrackingEnabled )
		mLiveTextures.insert( texture );
}

but i dont know what i wrong

Can I fix this? or Do you have any other ideas?

Your a constructor is being called before the opengl context has a chance to be initialised. You’ll need to create a on the heap from setup or defer the call to loadTexture