我的代码如下:
#include <iostream>
#include <SFML/Graphics.hpp>
int main(){
sf::RenderWindow window( sf::VideoMode(800,600), "title");
std::cout<<"123"<<std::endl;
return 0;
}
在consol上打印:
Setting vertical sync not supported
123
*** stack smashing detected ***: <unknown> terminated
Aborted (core dumped)
这意味着在调用sf :: RenderWindow的析构函数时会发生问题。我正在使用-lsfml-system -lsfml-window -lsfml-graphics
进行编译。
你能说出什么问题吗?
汉斯·帕桑特在评论中是正确的。