【问题标题】:Dynamic Linking in C++C++中的动态链接
【发布时间】:2018-10-10 16:13:25
【问题描述】:

我目前正在为我的一门课程分配 2D 游戏,我在 Visual Studio 社区 2017 上使用 SFML(一个 openGL 库)。我正在调试 Win32 系统。我将我的头文件、所有必需的库和预处理器连接到 SFML_STATIC。我尝试构建我从 sfml-dev.org 获得的这个示例程序:

#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;
}

我不断收到这些错误:

'FinalSpace.exe' (Win32): Loaded 'C:\Users\Mo'men\Desktop\GUC\Semester 5\Graphics\Assignment 1\FinalSpace\Debug\FinalSpace.exe'. Symbols loaded.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sfml-window-2.dll'. Module was built without symbols.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32full.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp_win.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbase.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp140d.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\win32u.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\vcruntime140d.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\opengl32.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sfml-system-2.dll'. Module was built without symbols.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\bcryptprimitives.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmm.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbased.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\glu32.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp140.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\vcruntime140.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmmbase.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmmbase.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\winmmbase.dll'
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imm32.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\uxtheme.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\combase.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msctf.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\oleaut32.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\nvhm.inf_amd64_ebea877f10dfbbc7\nvinit.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\version.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ig75icd32.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\ig75icd32.dll'
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ig75icd32.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shell32.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\SHCore.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\windows.storage.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\igdusc32.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shlwapi.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel.appcore.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\profapi.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\powrprof.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\fltLib.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wtsapi32.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dwmapi.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\version.dll'
'FinalSpace.exe' (Win32): Unloaded 'C:\Windows\System32\DriverStore\FileRepository\nvhm.inf_amd64_ebea877f10dfbbc7\nvinit.dll'
The thread 0x2dac has exited with code 0 (0x0).
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\version.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\version.dll'
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dinput8.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\InputHost.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\InputHost.dll'
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\InputHost.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\WinTypes.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\CoreMessaging.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\CoreUIComponents.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntmarta.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\hid.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\setupapi.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\devobj.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wintrust.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msasn1.dll'. Cannot find or open the PDB file.
'FinalSpace.exe' (Win32): Loaded 'C:\Windows\SysWOW64\crypt32.dll'. Cannot find or open the PDB file.
Exception thrown at 0x7687DDC2 in FinalSpace.exe: Microsoft C++ exception: std::length_error at memory location 0x008FF510.
Unhandled exception at 0x7687DDC2 in FinalSpace.exe: Microsoft C++ exception: std::length_error at memory location 0x008FF510.

我做错了什么,我该如何解决?

【问题讨论】:

  • 您在使用 Visual Studio 吗? software.intel.com/en-us/articles/…
  • 那些找不到 pdb 文件都不是错误。这只是意味着您没有安装符号,因此您无法在这些 dll 中进行调试(通常不需要,除非您认为您在第三方 dll 中发现了错误)。
  • 查看输出我确实看到了一个问题,看起来您在同一个应用程序中混合了调试和发布。应用程序不应同时需要'C:\Windows\SysWOW64\vcruntime140d.dll''C:\Windows\SysWOW64\vcruntime140.dll'。请注意,将调试库与调试应用程序一起使用并在发布应用程序中使用发布库非常重要。将两者混合将创建未定义的行为。

标签: c++ windows dll


【解决方案1】:

我认为这与您在属性中的链接有关.. 您是否将配置设置为活动调试并添加库依赖项 “sfml-graphics-d.lib”、“sfml-system-d.lib”、“sfml-window-d.lib”以及dll文件名末尾带有“-d”的dll文件。 提到dll文件在你应该添加它们的游戏文件夹中

【讨论】:

    【解决方案2】:

    这些“无法找到或打开 PDB”都不是错误。他们只是说没有找到那些指定模块的程序调试数据库。我不建议全部下载,所以我认为你很好。如果您确实想下载它们,请使用 VS 的设置并启用从微软符号服务器下载所有符号文件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-12
      • 2010-11-14
      • 2013-08-31
      • 1970-01-01
      相关资源
      最近更新 更多