与libswresample的cmake构建错误,与clang一起正常工作

时间:2018-08-19 17:44:54

标签: ffmpeg cmake clang clion

我正在使用CLion构建一个FFmpeg项目,该项目使用cmake来编译代码。在开始使用libswresample库之前,一切工作都很好。由于某些原因,cmake无法看到dylib,因此无法构建代码。

Completion handler was called.

但是,如果我运行此clang代码,则可以正常编译

/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake --build /Users/user/CLionProjects/IC4D/cmake-build-debug --target all -- -j 4
[ 50%] Linking C executable IC4D
Undefined symbols for architecture x86_64:
  "_swr_alloc_set_opts", referenced from:
      _audio_decode_frame in main.c.o
  "_swr_convert", referenced from:
      _audio_decode_frame in main.c.o
  "_swr_free", referenced from:
      _audio_decode_frame in main.c.o
  "_swr_init", referenced from:
      _audio_decode_frame in main.c.o
  "_swr_set_compensation", referenced from:
      _audio_decode_frame in main.c.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [IC4D] Error 1
make[1]: *** [CMakeFiles/IC4D.dir/all] Error 2
make: *** [all] Error 2

这是我的CMakeList.txt文件:

clang -I/usr/local/include -L/usr/local/lib -lavcodec -lavcodec -lswscale -lavformat -lswresample -lSDL2 -lavutil -o IC4D2 ../main.c

我的cmake怎么了?

谢谢

0 个答案:

没有答案