Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/66.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/algorithm/11.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
如何在mac上搜索、安装和包含/link C库?_C_Xcode_Macos_Package - Fatal编程技术网

如何在mac上搜索、安装和包含/link C库?

如何在mac上搜索、安装和包含/link C库?,c,xcode,macos,package,C,Xcode,Macos,Package,我已经安装了brew和xcode 我正在尝试安装LZ4C库 在Ubuntu上,我会使用: apt搜索lz4 sudo apt安装liblz4 dev 在Windows上,我会使用vcpkg 如何在MacOs(V11.3.1)上实现这一点 我试过: brew安装lz4 但是我的IDE没有检测到已安装的库或头文件,所以我假设这只是命令行版本 编辑:CLion不会自动从您的usr子目录检测库,使用Cmake添加include targets找到了确实安装了brew的头文件和库。您可能需要在项目设置中将

我已经安装了brew和xcode

我正在尝试安装LZ4C库

在Ubuntu上,我会使用:

apt搜索lz4

sudo apt安装liblz4 dev

在Windows上,我会使用
vcpkg

如何在MacOs(V11.3.1)上实现这一点

我试过:

brew安装lz4

但是我的IDE没有检测到已安装的库或头文件,所以我假设这只是命令行版本


编辑:CLion不会自动从您的
usr
子目录检测库,使用Cmake添加include targets找到了确实安装了
brew
的头文件和库。

您可能需要在项目设置中将
-I/opt/homebrew/include-L/opt/homebrew/lib-llz4
添加到编译器标志中
/opt/homebrew
适用于m1 Mac,如果您使用的是intel,请将其替换为
/usr/local

我还没有对其进行任何设置,但我认为可以使用。哦,您是对的,usr/local/include中有头文件。尝试将目标添加到CLion设置。将
target\u include\u目录(target\u Name PRIVATE/usr/local/include)
添加到
CMakeLists.txt
文件解决了此问题。Brew确实下载了dev库。显然,要让它链接,我需要相应的
target\u link\u directories
调用。