我一直试图将sfml静态链接到c ++项目,但是它总是给我带来编译器错误,有人知道这里发生了什么以及如何解决它;
编辑:
这是产生错误的代码:
这就是我在“链接器/包含/其他依赖项”部分中输入的内容:
我希望这就是您所需要的,但是如果还有其他问题,请具体说明(我是新来的人)
修改2: 这是所有错误:
严重性代码描述项目文件行抑制状态 错误LNK2019无法解析的外部符号_jpeg_std_error在函数“私有”中引用: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在函数“私有”中引用: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在函数“私有”中引用: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在函数“私有:布尔__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在函数“私有”中引用: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在函数“私有”中引用: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在函数“私有”中引用: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在函数“私有”中引用: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
答案 0 :(得分:0)
似乎您正在使用的SFML版本仍然依赖于libjpeg,但您并未链接它(因为在新版本中不再需要它)。
理想情况下,请从official repository下载最新的源代码,然后使用CMake对其进行编译,这将为您提供兼容且最新的文件。