使用SFML和Qt窗口不显示
Using SFML and Qt window not showing
我试图让SFML工作与Qt的创造者在过去的2天,但它只是不工作。程序在创建新窗口时失败,我不确定原因。
<<p> 应用程序输出/strong>Starting E:ProgramiranjeQT programibuild-SMFLConsoleGame-Desktop_Qt_5_3_MinGW_32bit-DebugdebugSMFLConsoleGame.exe...
The program has unexpectedly finished.
E:ProgramiranjeQT programibuild-SMFLConsoleGame-Desktop_Qt_5_3_MinGW_32bit-DebugdebugSMFLConsoleGame.exe crashed
编译输出
14:57:51: Running steps for project SMFLConsoleGame...
14:57:51: Configuration unchanged, skipping qmake step.
14:57:51: Starting: "E:ProgramiranjeQTToolsmingw482_32binmingw32-make.exe"
E:/Programiranje/QT/Tools/mingw482_32/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory 'E:/Programiranje/QT programi/build-SMFLConsoleGame-Desktop_Qt_5_3_MinGW_32bit-Debug'
g++ -c -pipe -fno-keep-inline-dllexport -g -std=c++0x -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_CORE_LIB -I..SMFLConsoleGame -I"....SFMLincludeSFML" -I"....QT5.3mingw482_32include" -I"....QT5.3mingw482_32includeQtCore" -I"debug" -I"." -I"....QT5.3mingw482_32mkspecswin32-g++" -o debugmain.o ..SMFLConsoleGamemain.cpp
g++ -Wl,-subsystem,console -mthreads -o debugSMFLConsoleGame.exe debug/main.o -LE:/Programiranje/SFML/lib -lsfml-system -lsfml-window -lsfml-graphics -lsfml-audio -LE:/Programiranje/QT/5.3/mingw482_32/lib -lQt5Cored
mingw32-make[1]: Leaving directory 'E:/Programiranje/QT programi/build-SMFLConsoleGame-Desktop_Qt_5_3_MinGW_32bit-Debug'
14:57:52: The process "E:ProgramiranjeQTToolsmingw482_32binmingw32-make.exe" exited normally.
14:57:52: Elapsed time: 00:02.
.pro
QT += core
QT -= gui
TARGET = SMFLConsoleGame
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
LIBS+= -LE:/Programiranje/SFML/lib
-lsfml-system
-lsfml-window
-lsfml-graphics
-lsfml-audio
INCLUDEPATH += E:/Programiranje/SFML/include/SFML
CONFIG += c++11
main.cpp
#include <iostream>
#include "System.hpp"
#include "Graphics.hpp"
int main()
{
sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(shape);
window.display();
}
return 0;
}
哈布斯堡你好,欢迎来stack exchange!我目前没有一个设置来测试这一点,但我怀疑你正在使用错误的库。我注意到您正在使用mingw,如果您查看sfml下载页面,有2种类型的库(SJLJ和DW2),使用错误的库可能导致崩溃,但是,调试输出可以告诉更多关于这个问题。
相关文章:
- 使用 while 循环时不显示窗口
- 有没有办法拿一个opencv显示窗口并将其保存到GUI窗口?
- SDL视频显示窗口:如何连接窗口关闭事件回调
- Qt:缓慢启动时显示窗口内容
- 为什么MessageBox在我创建的桌面中显示窗口,而AllocConsole在上一个桌面中显示它
- 如何显示窗口大小不同的输出图像?通过使用 cv::Mat
- QMLApplicationViewer 多个实例仅首先显示窗口
- 为什么HWND_NOTTOPMOST无法在xp中显示窗口前景
- 基本C++SFML显示窗口错误
- 使用Richedit控件时,基于对话框的Win32 API程序将不会显示窗口
- 显示窗口的极简主义Visual C++应用程序
- Win32:是否可以显示窗口,但在任务栏中隐藏它
- OpenCV-关闭图像显示窗口
- IWebBrowser2在渲染完成后显示窗口
- 防止在调用SDL_SetVideoMode后显示窗口
- 如何使用rad studio显示窗口总数
- Opencv highgui显示窗口
- 使用sfml显示窗口
- 跨平台c++库/库:显示窗口,在屏幕上渲染2D形状,在屏幕上渲染文本
- 用于创建菜单栏的c++ win32程序(程序编译并运行,也显示窗口但不显示菜单栏)