c++ - 静态链接 sfml 错误
问题描述
我一直在尝试将 sfml 静态链接到 C++ 项目,但它总是给我编译器错误,有谁知道这里发生了什么以及如何修复它;
编辑:
这是产生错误的代码:
这就是我放入 Linker/include/additional dependencies 部分的内容:
我希望这就是您所需要的,但如果还有其他问题,请具体说明(我是新手)
编辑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 unresolved externals Dungeon3.0 C:\Users\hhgra\source\repos\Dungeon3.0\Debug\Dungeon3.0.exe 1
解决方案
似乎您正在使用仍然依赖于 libjpeg 的过时版本的 SFML,而您没有链接它(因为在较新的版本中不再需要它)。
理想情况下,从官方存储库下载最新源代码并使用 CMake 进行编译,这将为您提供兼容和最新的文件。
推荐阅读
- hybris - 如何在 hybris 系统更新时自动加载 impex?
- rss - GitHub Markdown Pages 如何生成 RSS 提要
- sql - 来自相同选择语句的不同结果
- python - 如何禁用特定模块进行日志记录
- flutter - 我必须用什么来将图像放在底部颤动中?
- c# - IExtensibleDataObject 是否与 EmitDefaultValue 选项和 DataContractJsonSerializer 一起使用?
- c# - EF Core ToQueryString() 不包括架构
- python - 使用opencv从图像中检测文本
- linux - boot/grub/efi.img 无效图像大小
- azure - 在 .net api 中为 Azure DataLake 存储容器启用专用终结点