I want to use "static sf::Texture texture"as a member of a class.But when I compiled the code ,there have some wrong with its memory.
my compiler is VS2015.
here is the code:
Game.hpp:
#pragma once
#include"SFML\Graphics.hpp"
#include"SFML\Window.hpp"
#include<iostream>
class Game
{
public:
Game();
~Game();
private:
static sf::Texture texture;
};
Game.cpp:
#include "Game.hpp"
#include"SFML\Graphics.hpp"
#include"SFML\Window.hpp"
sf::Texture Game::texture;//memory wrong here
Game::Game()
{
}
Game::~Game()
{
}
0x773A5A13 (ntdll.dll)处(位于 Flighter2.exe 中)引发的异常: 0xC0000005: 写入位置(when writting in) 0x00000004 时发生访问冲突(conflict)。
as you see, I'm Chinese, my English is not good.......Thank you very mach for thinkint about my problem,sincerely~~!!