无法在动态链接库 sfml-graphics-2.dll 中找到过程入口点 _ZSt24__throw_out_of_range_fmtPKcz [英] The procedure entry point _ZSt24__throw_out_of_range_fmtPKcz could not be located in the dynamic link library sfml-graphics-2.dll

查看:83
本文介绍了无法在动态链接库 sfml-graphics-2.dll 中找到过程入口点 _ZSt24__throw_out_of_range_fmtPKcz的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天我决定下载、安装并尝试使用 SFML 2.2.我还下载了带有 MinGW 编译器的 Code::Blocks.我设置了所有内容并正确安装了所有内容(或者我认为是这样)并尝试运行示例代码以查看它是否有效:

Today I decided to download, install, and attempt to use SFML 2.2. I also downloaded Code::Blocks with the MinGW compiler. I set up everything and installed everything correctly (or so I thought) and tried to run a sample code to see if it would work:

#include <SFML/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;
}

代码编译正确,尽管尝试运行它,但出现错误消息框说过程入口点 _ZSt24__throw_out_of_range_fmtPKcz 无法在动态链接库 sfml-graphics-2.dll 中找到".我在网上搜索但没有找到与此问题相关的任何内容,所以我来到这里寻求帮助.感谢进一步的回答.

The code compiled correctly although trying to run it an error message box appears saying "The procedure entry point _ZSt24__throw_out_of_range_fmtPKcz could not be located in the dynamic link library sfml-graphics-2.dll". I searched the web but didn't find anything related to this problem, so I came here searching for help. Thanks to further answers.

推荐答案

此问题的主要原因是 DLL 的导入库是为您正在使用的 DLL 的不同版本创建的.

The main reason for this issue is the import libraries for the DLL's were created for a different version of the DLL you're using.

当您构建应用程序时,您使用了一个导入库,以便链接器能够找到您的应用程序正在调用的 SFML 函数.但是,DLL 本身不包含导入库具有存根的一个或多个函数.

When you built the application, you used an import library so that the linker will find the SFML functions that your application is calling. However, the DLL itself does not contain one or more of the functions that the import library has stubs for.

创建隐式加载 DLL 的应用程序需要 3 个步骤:

When creating an application that implcitly loads a DLL entails a 3 step process:

  1. 编译代码
  2. 链接代码
  3. 运行代码

编译器只关心程序的语法是否正确.这工作没有错误.

All the compiler cares about is that the program is syntactically correct. This worked without error.

链接器阶段确定您调用的函数是否实际存在.这就是事情变得棘手的地方,因为函数存根存在于导入库中,这将使链接器满意.导入库告诉链接器,是的,这个函数在这个 DLL 中,所以相信我".这对你来说也没有错误

The linker stage determines if the functions you're calling actually exist. This is where things get tricky, since the function stubs exist in the import library, and that will satisfy the linker. The import library tells the linker, "yes, this function is here in this DLL, so trust me". This also worked without error for you

(请注意,这在非 DLL 场景中有所不同,链接器将实际查找函数本身,而不是存根).

然而,实际函数本身位于不同的模块 (DLL) 中,您的应用程序唯一可以确定它们存在的时间是您运行程序时.这就是你现在卡住的地方.

However, the actual functions themselves are in a different module (DLL), and the only time your application can determine their existence is when you run the program. This is where you're stuck right now.

因此,您首先应该做的是确保您在构建应用程序时使用的导入库与您在运行时加载的 DLL 相匹配.如果您仍然遇到错误,请联系您获得 DLL 的位置并询问如何获得正确的导入库.

So the thing you should do first is make sure that the import libraries you're using when building your application match up with the DLL's that you're loading at runtime. If you still get the error, contact where you got the DLL's and inquire how to get the proper import libraries.

此外,如果由于某种原因您无法获得导入库,还有一些方法可以从 DLL 创建导入库.我不知道如何为 MingW 手动执行此操作的所有详细信息,但这些信息应该可以在网上某处找到.

In addition, there are ways to create an import library from a DLL, if for some reason you can't get the import libraries. I don't know all the details of how to do this manually for MingW, but the information should be available online somewhere.

这篇关于无法在动态链接库 sfml-graphics-2.dll 中找到过程入口点 _ZSt24__throw_out_of_range_fmtPKcz的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆