Я изучил этот вопрос некоторое время, и я думаю, что я сузил проблему.Не удается загрузить ntdll.dll
Это ошибка выхода
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).
стек вызовов выглядит следующим образом
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]
Другие ответы предполагают удаление статического члена, который не был объявлен должным образом или что-то похожее на это. Однако в (предполагаемом) затронутом классе существует статический вектор, который я не могу найти для удаления. Какие-либо предложения?
[Это класс я думаю, что ошибки происходит от] (строка 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;
};
Static члены объявлены в Tile.cpp
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 Tile Tile :: xxxx' должен быть' const Tile :: xxxx' –
@ Jean-FrançoisFabre Ум. Я так не думаю. Эти члены (три из них) являются объектами 'Tile', статичными для класса' Tile' (что разрешено). – WhozCraig