mac环境下,使用vs搭建ffmpeg开发环境
百度了很多,我的vs跟百度上的不一样啊,大多数的配置都是在windows的图形界面上配置的。
环境配置好以后,要将ffmpeg头文件,和库文件链接到C++工程中
-
配置头文件查找路径,c_pp_properties.json
-
配置库文件链接路径,tasks.json,头文件也可以在这配置,用大写的i方式
附上全部的配置文件 -
c_cpp_properties.json
{
"configurations": [
{
"name": "Mac",
"includePath": [
"${workspaceFolder}/**",
"/usr/local/Cellar/ffmpeg/4.1.3_1/include"
],
"defines": [],
"macFrameworkPath": [
"/System/Library/Frameworks",
"/Library/Frameworks"
],
"compilerPath": "/usr/bin/clang",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64"
}
],
"version": 4
}
- launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "(lldb) Launch", // 配置名称,将会在启动配置的下拉菜单中显示
"type": "cppdbg", // 配置类型,这里只能为cppdbg
"request": "launch", // 请求配置类型,可以为launch(启动)或attach(附加)
"program": "${workspaceFolder}/main.out", // 将要进行调试的程序的路径
"args": [], // 程序调试时传递给程序的命令行参数,一般设为空即可
"stopAtEntry": false, // 设为true时程序将暂停在程序入口处,一般设置为false
"cwd": "${workspaceFolder}", // 调试程序时的工作目录,一般为${workspaceRoot}即代码所在目录
"environment": [],
"externalConsole": true, // 调试时是否显示控制台窗口,一般设置为true显示控制台
"MIMode": "lldb" // 调试会话开始前执行的任务,一般为编译程序,c++为g++, c为gcc
}
]
}
- tasks.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "hello world",
"type": "shell",
"command": "g++",
"args": [
"-g", // 加上这个才可以debug断点调试
"main.cpp",
"-o",
"main.out",
"-L",
"/usr/local/Cellar/ffmpeg/4.1.3_1/lib",
"-l",
"avformat"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}