静态链接 sfml 错误
Static linking sfml errors
我一直在尝试静态 link sfml 到 c++ 项目,但它总是给我编译器错误,有谁知道这里发生了什么以及如何修复它;
编辑:
这是产生错误的代码:
这就是我放入 Linker/include/additional 依赖项部分的内容:
我希望这就是你所需要的,但如果还有什么,请具体说明(我是新手)
编辑 2:
以下是所有错误:
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol _jpeg_std_error referenced in function "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-s-d.lib(ImageLoader.cpp.obj) 1
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol _jpeg_CreateCompress referenced in function "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-s-d.lib(ImageLoader.cpp.obj) 1
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol _jpeg_destroy_compress referenced in function "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-s-d.lib(ImageLoader.cpp.obj) 1
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol _jpeg_stdio_dest referenced in function "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-s-d.lib(ImageLoader.cpp.obj) 1
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol _jpeg_set_defaults referenced in function "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-s-d.lib(ImageLoader.cpp.obj) 1
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol _jpeg_set_quality referenced in function "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-s-d.lib(ImageLoader.cpp.obj) 1
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol _jpeg_start_compress referenced in function "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-s-d.lib(ImageLoader.cpp.obj) 1
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol _jpeg_write_scanlines referenced in function "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-s-d.lib(ImageLoader.cpp.obj) 1
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol _jpeg_finish_compress referenced in function "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-s-d.lib(ImageLoader.cpp.obj) 1
Severity Code Description Project File Line Suppression State
Error LNK1120 9 unresolved externals Dungeon3.0 C:\Users\hhgra\source\repos\Dungeon3.0\Debug\Dungeon3.0.exe 1
似乎您使用的是 SFML 的过时版本,它仍然依赖于 libjpeg,而您并未使用 link(因为新版本不再需要它)。
理想情况下,从 official repository 下载最新的源代码并使用 CMake 编译它,这将为您提供兼容的最新文件。
我一直在尝试静态 link sfml 到 c++ 项目,但它总是给我编译器错误,有谁知道这里发生了什么以及如何修复它;
编辑:
这是产生错误的代码:
这就是我放入 Linker/include/additional 依赖项部分的内容:
我希望这就是你所需要的,但如果还有什么,请具体说明(我是新手)
编辑 2: 以下是所有错误:
Severity Code Description Project File Line Suppression State Error LNK2019 unresolved external symbol _jpeg_std_error referenced in function "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-s-d.lib(ImageLoader.cpp.obj) 1
Severity Code Description Project File Line Suppression State Error LNK2019 unresolved external symbol _jpeg_CreateCompress referenced in function "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-s-d.lib(ImageLoader.cpp.obj) 1
Severity Code Description Project File Line Suppression State Error LNK2019 unresolved external symbol _jpeg_destroy_compress referenced in function "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-s-d.lib(ImageLoader.cpp.obj) 1
Severity Code Description Project File Line Suppression State Error LNK2019 unresolved external symbol _jpeg_stdio_dest referenced in function "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-s-d.lib(ImageLoader.cpp.obj) 1
Severity Code Description Project File Line Suppression State Error LNK2019 unresolved external symbol _jpeg_set_defaults referenced in function "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-s-d.lib(ImageLoader.cpp.obj) 1
Severity Code Description Project File Line Suppression State Error LNK2019 unresolved external symbol _jpeg_set_quality referenced in function "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-s-d.lib(ImageLoader.cpp.obj) 1
Severity Code Description Project File Line Suppression State Error LNK2019 unresolved external symbol _jpeg_start_compress referenced in function "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-s-d.lib(ImageLoader.cpp.obj) 1
Severity Code Description Project File Line Suppression State Error LNK2019 unresolved external symbol _jpeg_write_scanlines referenced in function "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-s-d.lib(ImageLoader.cpp.obj) 1
Severity Code Description Project File Line Suppression State Error LNK2019 unresolved external symbol _jpeg_finish_compress referenced in function "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-s-d.lib(ImageLoader.cpp.obj) 1
Severity Code Description Project File Line Suppression State Error LNK1120 9 unresolved externals Dungeon3.0 C:\Users\hhgra\source\repos\Dungeon3.0\Debug\Dungeon3.0.exe 1
似乎您使用的是 SFML 的过时版本,它仍然依赖于 libjpeg,而您并未使用 link(因为新版本不再需要它)。
理想情况下,从 official repository 下载最新的源代码并使用 CMake 编译它,这将为您提供兼容的最新文件。