SFML 不启动窗口
SFML doesn't launch window
我刚开始进行2D视频游戏编程,我决定使用Eclipse,因为我已经习惯了在Java开发中使用Eclipse。我还决定使用SFML,并为Eclipse安装了C/c++工具,并使用MinGW作为GCC编译器。我在外部库链接和包含方面遇到了很多麻烦,但它假设已经修复了,因为我在编译时没有错误消息。
现在,当我尝试编译和执行像这样的任何代码时(它们都直接取自SFML教程):
#include <SFML/Graphics.hpp>
int main()
{
// create the window
sf::RenderWindow window(sf::VideoMode(800, 600), "My window");
// run the program as long as the window is open
while (window.isOpen())
{
// check all the window's events that were triggered since the last iteration of the loop
sf::Event event;
while (window.pollEvent(event))
{
// "close requested" event: we close the window
if (event.type == sf::Event::Closed)
window.close();
}
// clear the window with black color
window.clear(sf::Color::Black);
// draw everything here...
// window.draw(...);
// end the current frame
window.display();
}
return 0;
}
发生任何事情,它应该启动一个空窗口…
Eclipse的配置在教程中没有明确说明,所以我做的库配置是这样的,我检查了:
C:MinGWbin添加到项目环境PATH。
Project Properties> C/c++ Build> Settings> MinGW c++ Linker> Libraries,从需要的库开始,直到不需要的库,如教程所解释的(sfml-graphics, sfml-window, sfml-system)。也尝试了sfml-xxx-d库,仍然不起作用。
Project Properties> C/c++ Build> Tool Chain Editor> Current builder = Gnu make builder。
运行配置>参数>程序参数:-SFML_DYNAMIC
我在4个多小时的时间里一直在试图解决这个问题,所以我需要帮助,否则我会发疯的…谢谢大家。
我没有解释,但我有同样的问题与"调试"库链接。我可以通过在"调试"模式下启动应用程序来使其工作。
相关文章:
- 如何使用C++确定应用程序是否已在窗口中启动?
- 无法启动 OpenGL 窗口
- 在SFML(C++)中启动一个新窗口
- FreeGLUT窗口在启动时消失
- 使用 c++ 在 Mac OS X 上启动"new email"窗口
- 从窗口启动程序时如何查看键盘修饰符?
- 如何在最大化窗口中启动 VTK 程序
- 在 d3d->CreateDevice 中D3DERR_INVALIDCALL,导致在 Allegro 5 D3D 程序中启动时窗口闪烁
- 系统( "bcdedit /set safeboot" ) 未将窗口设置为安全启动
- 使用启动命令启动命令时,将命令传递到另一个 cmd 窗口
- 强制将以SW_HIDE启动的进程中的窗口显示为STARTUPINFO
- 有没有办法接收有关在窗口中启动的进程的事件
- 查询/查找启动过程窗口
- 基于CDialog的应用程序启动时,如何将我的辅助对话框窗口带到顶部
- 如何在新的终端窗口中启动 ./a.out
- Qt:缓慢启动时显示窗口内容
- 从控制台应用程序启动窗口应用程序
- SDL窗口在启动时关闭并返回0
- Visual Studio:如何在没有控制台窗口的情况下启动项目
- 以弹出窗口的形式启动另一个应用程序