gpt4 book ai didi

c++ - 适用于 Windows 的 Linux mingw32 sfml 交叉编译 - 缺少 dll 文件

转载 作者:可可西里 更新时间:2023-11-01 18:39:59 25 4
gpt4 key购买 nike

我正在按以下方式编译我的 C++ 项目:

/usr/bin/i686-w64-mingw32-g++ -g -std=c++0x -Wall -I /home/bluszcz/dev/win64/SFML-2.1/include -L /home/bluszcz/dev/win64/SFML-2.1/lib -static-libgcc -static-libstdc++ -static -O4 -c src/game.cpp -o src/game.a -lsfml-graphics -lsfml-window -lsfml-system -lsfml-audio

但是,当我尝试运行我的 exe 文件时,我收到有关缺少 DLL 文件的错误消息:

bluszcz@zendo ~/dev/win32/builds/magicwizard $ wine mw.exe 
err:module:import_dll Library libgcc_s_dw2-1.dll (which is needed by L"Z:\\home\\bluszcz\\dev\\win32\\builds\\magicwizard\\sfml-system-2.dll") not found
err:module:import_dll Library libgcc_s_sjlj-1.dll (which is needed by L"Z:\\home\\bluszcz\\dev\\win32\\builds\\magicwizard\\libstdc++-6.dll") not found
err:module:import_dll Library libwinpthread-1.dll (which is needed by L"Z:\\home\\bluszcz\\dev\\win32\\builds\\magicwizard\\libstdc++-6.dll") not found
err:module:import_dll Library libstdc++-6.dll (which is needed by L"Z:\\home\\bluszcz\\dev\\win32\\builds\\magicwizard\\sfml-system-2.dll") not found
err:module:import_dll Library sfml-system-2.dll (which is needed by L"Z:\\home\\bluszcz\\dev\\win32\\builds\\magicwizard\\sfml-audio-2.dll") not found
err:module:import_dll Library libgcc_s_dw2-1.dll (which is needed by L"Z:\\home\\bluszcz\\dev\\win32\\builds\\magicwizard\\sfml-audio-2.dll") not found
err:module:import_dll Library libgcc_s_sjlj-1.dll (which is needed by L"Z:\\home\\bluszcz\\dev\\win32\\builds\\magicwizard\\libstdc++-6.dll") not found
err:module:import_dll Library libwinpthread-1.dll (which is needed by L"Z:\\home\\bluszcz\\dev\\win32\\builds\\magicwizard\\libstdc++-6.dll") not found
err:module:import_dll Library libstdc++-6.dll (which is needed by L"Z:\\home\\bluszcz\\dev\\win32\\builds\\magicwizard\\sfml-audio-2.dll") not found

我已经使用 static 选项进行了编译 - 那么为什么它要求 libgcc_s_dw2-1.dll 例如?

另外,我在那里复制了一些文件,但应用程序仍然看不到它们。

bluszcz@zendo ~/dev/win32/builds/magicwizard $ ls *dll
libsndfile-1.dll sfml-audio-2.dll sfml-graphics-d-2.dll sfml-system-2.dll sfml-window-d-2.dll
libstdc++-6.dll sfml-audio-d-2.dll sfml-network-2.dll sfml-system-d-2.dll
openal32.dll sfml-graphics-2.dll sfml-network-d-2.dll sfml-window-2.dll
bluszcz@zendo ~/dev/win32/builds/magicwizard $

还有一些文件,例如 libgcc_s_dw2-1.dll,根本不存在于我的文件系统中...

总结:

  1. 为什么我的应用程序看不到丢失的文件?
  2. 如何用mingw32静态编译?
  3. 如何获取丢失的文件?

我使用这个版本的 sfml 库来编译它:http://www.sfml-dev.org/download/sfml/2.1/SFML-2.1-windows-gcc-4.7-mingw-32bits.zip

最佳答案

在用 wine 运行你的程序之前,可以简单地将丢失的 dll 添加到你的 WINEPATH,即

export WINEPATH="/usr/x86_64-w64-mingw32/lib;/usr/lib/gcc/x86_64-w64-mingw32/7.3-posix"

!请注意,根据您使用的 mingw 版本,您的路径可能会略有不同。

关于c++ - 适用于 Windows 的 Linux mingw32 sfml 交叉编译 - 缺少 dll 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24332343/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com