Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
未找到SFML库 我试图用SFube链接SFML到C++项目。此设置在我的Linux计算机上运行良好,但当我尝试在mac上构建时,它找不到库:ld:library not found for-lsfml network。我在这两台机器上安装的SFML完全相同(与我的安装方式相同)_C++_Cmake_Linker Errors - Fatal编程技术网

未找到SFML库 我试图用SFube链接SFML到C++项目。此设置在我的Linux计算机上运行良好,但当我尝试在mac上构建时,它找不到库:ld:library not found for-lsfml network。我在这两台机器上安装的SFML完全相同(与我的安装方式相同)

未找到SFML库 我试图用SFube链接SFML到C++项目。此设置在我的Linux计算机上运行良好,但当我尝试在mac上构建时,它找不到库:ld:library not found for-lsfml network。我在这两台机器上安装的SFML完全相同(与我的安装方式相同),c++,cmake,linker-errors,C++,Cmake,Linker Errors,我的CMakeLists.txt链接如下所示: target\u link\u库(游乐场${OpenCV\u LIBS}sfml网络sfml窗口sfml图形sfml系统) SFML有一个关于的教程。它提供了一个FindSFML.cmake文件,因此您可以简单地使用find\u包和target\u link\u库: find_package(SFML REQUIRED COMPONENTS network window graphics system) # ... target_link_lib

我的CMakeLists.txt链接如下所示:

target\u link\u库(游乐场${OpenCV\u LIBS}sfml网络sfml窗口sfml图形sfml系统)

SFML有一个关于的教程。它提供了一个
FindSFML.cmake
文件,因此您可以简单地使用
find\u包
target\u link\u库

find_package(SFML REQUIRED COMPONENTS network window graphics system)
# ...

target_link_libraries(Playground
  ${SFML_LIBRARIES}

# If SFML did it correctly, this shouldn't be needed, but I can't tell from the
# documentation if they did:
  ${SFML_DEPENDENCIES}
)

没有cmake你能让它工作吗?然后你至少可以排除这种影响,并相应地减少你的问题。这遵循了提取MCVE的规则,你应该从好问题指南中知道这一点。嗯,我没试过。它通过正常链接工作,但不通过CMake工作,这是为什么?在CMake之后运行
make VERBOSE=1
,查看CMake给编译器的确切标志。这可以更容易地诊断问题
FindSFML.cmake
文件最近已被删除(尽管可以在源repo的早期版本中找到),而此时教程似乎尚未更新。看起来最近对CMake系统进行了一些结构上的更改,我希望能很快找到更新的文档。更新:
FindSFML.CMake
已被
SFMLConfig.CMake
替换,如中所述。用法类似,稍微简单一点。