C++ VS2012调试中SFML变量周围的堆栈已损坏
我正在使用Visual Studio 2012。在调试模式下编译时,以下代码会导致错误 运行时检查失败#2-变量“line”周围的堆栈已损坏C++ VS2012调试中SFML变量周围的堆栈已损坏,c++,visual-studio-2012,sfml,C++,Visual Studio 2012,Sfml,我正在使用Visual Studio 2012。在调试模式下编译时,以下代码会导致错误 运行时检查失败#2-变量“line”周围的堆栈已损坏 #包括 #包括 int main() { 标准::cout引用以下内容的红色部分: 链接到与配置匹配的库非常重要:“sfml-xxx-d.lib”用于调试,“sfml-xxx.lib”用于发布。错误的组合可能会导致崩溃 在调试生成设置中,确保链接的是SFML库的调试版本(如果可用)。 #include <SFML/Graphics.hpp> #
#包括
#包括
int main()
{
标准::cout引用以下内容的红色部分:
链接到与配置匹配的库非常重要:“sfml-xxx-d.lib”用于调试,“sfml-xxx.lib”用于发布。错误的组合可能会导致崩溃
在调试生成设置中,确保链接的是SFML库的调试版本(如果可用)。
#include <SFML/Graphics.hpp>
#include <iostream>
int main()
{
std::cout << "Please ignore this box\n";
sf::Font font;
if (!font.loadFromFile("font.ttf"))
std::cout << "Font not loaded\n";
sf::RenderWindow window(sf::VideoMode(1000, 800),
"Test Window",
sf::Style::Titlebar | sf::Style::Close);
if (!window.isOpen())
std::cout << "Problem creating window\n";
while (window.isOpen()) {
sf::Event event;
while (window.pollEvent(event)) {
if (event.type == sf::Event::Closed)
window.close();
}
window.clear(sf::Color::Black);
sf::RectangleShape line(sf::Vector2f(2, 750));
line.setFillColor(sf::Color::White);
line.setPosition(700, 25);
window.draw(line);
window.display();
}
return 0;
}