libuvc 程序不编译

libuvc program does not compile

我正在尝试在我的 C/C++ 项目之一中使用 libuvc。我从源代码成功编译并安装了 libusb 和 libuvc,当我尝试使用 gcc 编译以下代码时:

#include "libuvc/libuvc.h"

int main (int argc, const char **argv) {
    uvc_init(NULL, NULL);
}

我收到以下错误:

Undefined symbols for architecture x86_64:
  "_uvc_init", referenced from:
      _main in main-de2855.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我使用的是 MacOS High Sierra 10.13.1 x64。

我使用了命令:

gcc main.c -luvc -o main

成功了!添加 -luvc 标志解决了我的问题,但我不明白为什么我需要使用它。在使用其他 C/C++ 依赖项之前,我从来不需要标志。