【问题标题】:Static linking sfml errors静态链接 sfml 错误
【发布时间】:2018-12-03 01:38:58
【问题描述】:

我一直在尝试将 sfml 静态链接到 c++ 项目,但它总是给我编译器错误,有谁知道这里发生了什么以及如何修复它;

编辑:

这是产生错误的代码:

这就是我放入链接器/包含/附加依赖项部分的内容:

我希望这就是您所需要的,但如果还有其他问题,请具体说明(我是新手)

编辑 2: 以下是所有错误:

严重性代码描述项目文件行抑制状态 错误 LNK2019 未解析的外部符号 _jpeg_std_error 在函数“private: bool __thiscall sf::priv::ImageLoader::writeJpg(class std::basic_string,class std::allocator > const &,class std::vector > const &,unsigned int,unsigned int)" (?writeJpg@ImageLoader@priv@sf@@AAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV?$vector@ EV?$allocator@E@std@@@5@II@Z) Dungeon3.0 C:\Users\hhgra\source\repos\Dungeon3.0\Dungeon3.0\sfml-graphics-sd.lib(ImageLoader.cpp .obj) 1

严重性代码描述项目文件行抑制状态 错误 LNK2019 未解析的外部符号 _jpeg_CreateCompress 在函数“private: bool __thiscall sf::priv::ImageLoader::writeJpg(class std::basic_string,class std::allocator > const &,class std::vector > const &,unsigned int,unsigned int)" (?writeJpg@ImageLoader@priv@sf@@AAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV?$vector@ EV?$allocator@E@std@@@5@II@Z) Dungeon3.0 C:\Users\hhgra\source\repos\Dungeon3.0\Dungeon3.0\sfml-graphics-sd.lib(ImageLoader.cpp .obj) 1

严重性代码描述项目文件行抑制状态 错误 LNK2019 未解析的外部符号 _jpeg_destroy_compress 在函数“private: bool __thiscall sf::priv::ImageLoader::writeJpg(class std::basic_string,class std::allocator > const &,class std::vector > const &,unsigned int,unsigned int)" (?writeJpg@ImageLoader@priv@sf@@AAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV?$vector@ EV?$allocator@E@std@@@5@II@Z) Dungeon3.0 C:\Users\hhgra\source\repos\Dungeon3.0\Dungeon3.0\sfml-graphics-sd.lib(ImageLoader.cpp .obj) 1

严重性代码描述项目文件行抑制状态 错误 LNK2019 未解析的外部符号 _jpeg_stdio_dest 在函数“private: bool __thiscall sf::priv::ImageLoader::writeJpg(class std::basic_string,class std::allocator > const &,class std::vector > const &,unsigned int,unsigned int)" (?writeJpg@ImageLoader@priv@sf@@AAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV?$vector@ EV?$allocator@E@std@@@5@II@Z) Dungeon3.0 C:\Users\hhgra\source\repos\Dungeon3.0\Dungeon3.0\sfml-graphics-sd.lib(ImageLoader.cpp .obj) 1

严重性代码描述项目文件行抑制状态 错误 LNK2019 未解析的外部符号 _jpeg_set_defaults 在函数“private: bool __thiscall sf::priv::ImageLoader::writeJpg(class std::basic_string,class std::allocator > const &,class std::vector > const &,unsigned int,unsigned int)" (?writeJpg@ImageLoader@priv@sf@@AAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV?$vector@ EV?$allocator@E@std@@@5@II@Z) Dungeon3.0 C:\Users\hhgra\source\repos\Dungeon3.0\Dungeon3.0\sfml-graphics-sd.lib(ImageLoader.cpp .obj) 1

严重性代码描述项目文件行抑制状态 错误 LNK2019 未解析的外部符号 _jpeg_set_quality 在函数“private: bool __thiscall sf::priv::ImageLoader::writeJpg(class std::basic_string,class std::allocator > const &,class std::vector > const &,unsigned int,unsigned int)" (?writeJpg@ImageLoader@priv@sf@@AAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV?$vector@ EV?$allocator@E@std@@@5@II@Z) Dungeon3.0 C:\Users\hhgra\source\repos\Dungeon3.0\Dungeon3.0\sfml-graphics-sd.lib(ImageLoader.cpp .obj) 1

严重性代码描述项目文件行抑制状态 错误 LNK2019 未解析的外部符号 _jpeg_start_compress 在函数“private: bool __thiscall sf::priv::ImageLoader::writeJpg(class std::basic_string,class std::allocator > const &,class std::vector > const &,unsigned int,unsigned int)" (?writeJpg@ImageLoader@priv@sf@@AAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV?$vector@ EV?$allocator@E@std@@@5@II@Z) Dungeon3.0 C:\Users\hhgra\source\repos\Dungeon3.0\Dungeon3.0\sfml-graphics-sd.lib(ImageLoader.cpp .obj) 1

严重性代码描述项目文件行抑制状态 错误 LNK2019 未解析的外部符号 _jpeg_write_scanlines 在函数“private: bool __thiscall sf::priv::ImageLoader::writeJpg(class std::basic_string,class std::allocator > const &,class std::vector > const &,unsigned int,unsigned int)" (?writeJpg@ImageLoader@priv@sf@@AAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV?$vector@ EV?$allocator@E@std@@@5@II@Z) Dungeon3.0 C:\Users\hhgra\source\repos\Dungeon3.0\Dungeon3.0\sfml-graphics-sd.lib(ImageLoader.cpp .obj) 1

严重性代码描述项目文件行抑制状态 错误 LNK2019 未解析的外部符号 _jpeg_finish_compress 在函数“private: bool __thiscall sf::priv::ImageLoader::writeJpg(class std::basic_string,class std::allocator > const &,class std::vector > const &,unsigned int,unsigned int)" (?writeJpg@ImageLoader@priv@sf@@AAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV?$vector@ EV?$allocator@E@std@@@5@II@Z) Dungeon3.0 C:\Users\hhgra\source\repos\Dungeon3.0\Dungeon3.0\sfml-graphics-sd.lib(ImageLoader.cpp .obj) 1

严重性代码描述项目文件行抑制状态 错误 LNK1120 9 无法解析的外部 Dungeon3.0 C:\Users\hhgra\source\repos\Dungeon3.0\Debug\Dungeon3.0.exe 1

【问题讨论】:

  • edit以文字形式提供文字信息。
  • 你做了什么来链接那个库?请显示等效的命令行,例如使用 gcc,以及一个具有相同错误的小程序。这将使您的问题缺少minimal reproducible example
  • 我已经用你要求的那些东西的图片更新了它
  • 是的,还有更多文字图片。请阅读您对某个问题的反馈。请将文本显示为文本。
  • 你的意思是错误信息;

标签: c++ visual-c++ sfml static-linking


【解决方案1】:

您似乎在使用仍然依赖于 libjpeg 的过时版本的 SFML,而您没有链接它(因为在较新的版本中不再需要它)。

理想情况下,从official repository 下载最新源代码并使用 CMake 进行编译,这将为您提供兼容且最新的文件。

【讨论】:

    猜你喜欢
    • 2019-06-27
    • 1970-01-01
    • 1970-01-01
    • 2016-10-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-18
    • 1970-01-01
    相关资源
    最近更新 更多