在 linux 上使用 i586-mingw32msvc-g++ 和 SFML 编译的错误 运行 .exe

Error running .exe compiled with i586-mingw32msvc-g++ and SFML on linux

编辑:感谢随机投票者!

编辑 2:感谢@πìνταῥεῖ 解释问题的错误所在。当 运行 使用调试器时,我得到

Program received signal SIGSEGV, Segmentation fault.
0x0046f4c6 in ?? ()

编辑 3:只有当我 运行 交叉编译程序时才会发生这种情况。如果我用 WINE 编译 Windows 和 运行 中的程序,没有任何错误发生。

好吧,我现在正在与 WINE 和 MinGW32 作斗争。 所以我有一个文件,sortem.cpp,它是用 Makefile 编译并链接的,全部来自那个 Makefile。

sortem.cpp

#include <windows.h>
#include <iostream>
#include <string>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>

int main ()
{
    sf::RenderWindow window;
    window.create(sf::VideoMode(720,480),"Sort 'em!");
    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
            {
                window.clear();
                switch (event.type)
                {
                    case sf::Event::Closed:
                        window.close();
                }
                window.display();
            }
    }
    return 0;
}

生成文件

LD = ../bin
LIBS= $(LD)/sfml-window-2.dll $(LD)/sfml-system-2.dll $(LD)/sfml-graphics-2.dll $(LD)/sfml-network-2.dll $(LD)/sfml-audio-2.dll
OBJECTS= sortem.o
CXX= i586-mingw32msvc-g++
all: sortem.exe

sortem.exe: $(OBJECTS)
     $(CXX) -o ../bin/sortem.exe $(OBJECTS) $(LIBS)

%.o: %.cpp 
    $(CXX) -c $<

clean:
     rm *.o 

所以程序编译完美,但是当 运行ning sortem.exe 使用 WINE 时,它说程序必须退出。我点击 "Show details" 弹出。 Unhandled exception: page fault on write access to 0x00000000 in 32-bit code (0x0046f4c6).还有很多十六进制转储。我真的不知道我做错了什么,也许 SFML 库不是最新的?但这会给我一个编译错误,而不是 运行 时间错误...非常感谢您的帮助,伙计们。

这些库是用 MinGW GCC 4.7.1 编译的,我试图用 MinGW GCC 4.8.1 编译我的程序,感谢一位朋友降级并重新上线。谢谢你们教我如何调试。 和平