私はこの質問をしばらく調査しましたが、問題を絞り込んだと思います。ntdll.dllを読み込めません
これは
ucrtbased.dll!0f8aa672() Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for ucrtbased.dll]
[External Code]
> Duke's Army.exe!Tile::Tile() Line 19 C++
[External Code]
Duke's Army.exe!Map::Map(int w, int h) Line 70 C++
Duke's Army.exe!MapGenerator::init(int w, int h) Line 37 C++
Duke's Army.exe!MapGenerator::MapGenerator(int w, int h) Line 13 C++
Duke's Army.exe!PlayGameState::PlayGameState(Game * g) Line 13 C++
Duke's Army.exe!main() Line 11 C++
[External Code]
他の回答を以下のようにエラー出力
Critical error detected c0000374
Duke's Army.exe has triggered a breakpoint.
Exception thrown at 0x77E49841 (ntdll.dll) in Duke's Army.exe: 0xC0000374: A heap has been corrupted (parameters: 0x77E7C8D0).
Unhandled exception at 0x77E49841 (ntdll.dll) in Duke's Army.exe: 0xC0000374: A heap has been corrupted (parameters: 0x77E7C8D0).
The program '[14436] Duke's Army.exe' has exited with code 0 (0x0).
コールスタックがあるが、適切に宣言されていない静的メンバまたはそれに似たものを取り除く示唆しています。しかし、(想定される)影響を受けるクラスには、削除する方法が見つからない静的なベクトルがあります。助言がありますか?
[これは私がエラーが発生したからだと思うクラスである] (コールスタック内ライン19は、デフォルトコンストラクタの定義の始まりである)
Tile.h
class Tile
{
public:
static std::vector<Tile> tiles;
// Constructors and methods...
// Method used in constructors to add to static tiles
void Tile::init(const std::string& n, const sf::Color& c) {
this->name = n;
this->color = c;
tiles.push_back(*this);
}
Tile(std::string n, sf::Color c) {
init(n, c);
};
Tile() {
init("bounds", sf::Color::Black);
}
const static Tile wall;
const static Tile floor;
const static Tile bounds;
const static float TILE_SIZE;
};
静的メンバーは
std::vector<Tile> Tile::tiles = std::vector<Tile>(3);
const Tile Tile::wall("wall", sf::Color::White);
const Tile Tile::floor("floor", sf::Color::Green);
const Tile Tile::bounds;
const float Tile::TILE_SIZE = 16.f;
私は問題は任意の宣言コードであることを行っているとは思いません。コンストラクタとメソッドを確認してください。 –
'constタイルタイル:: xxxx'は' const Tile :: xxxx'でなければなりません –
@ Jean-FrançoisFabreUm。私はそうは思わない。それらのメンバー(そのうち3つ)は 'Tile'クラスに静的な' Tile'オブジェクトです(許可されています)。 – WhozCraig