Jump to content

Recommended Posts

  • Premium

Hi,

So, as the title says my client launcher is crashing when I initialize a variable.

I declared a class like this:

class CMyClass : public CSingleton<CMyClass>
{
	private:
		int var;
	public:
		void Initialize();
}

And the function Initialize():

void CMyClass::Initialize()
{
	var = 123;
}

No error at compilation, but when I run the launcher it's crashing.

I don't get it. Why is this happening?

Link to comment
https://metin2.dev/topic/5263-launcher-crash-when-i-initialize-a-variable/
Share on other sites

  • Premium

You have to create at least one instance of the class before you're using singleton.

 

I don't get what you're exactly saying, but I've tried to call my function using these two ways:

CMyClass::instance().Initialize();

and

CMyClass mc;
mc.Initialize();
  • Premium

First you have to make an instance of the class:

 

CMyClass mc;

 

And then you can use singleton on it:

 

CMyClass::instance().Initialize();

 

That's some bullshit from C++.

Anyway, thanks.

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.