直播相关01-录制麦克风声音,QT上 .pro 将 linux,mac和windows上配置为三种可以共享, 在.pro文件中 message 的作用

一 QT 上的 .pro 文件 将 linux,mac和windows上配置设置为可以共享

1. 先来看文件夹布局

2. 再来看 QT 中的 .pro文件

.pro 文件的写法

复制代码
QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

CONFIG += c++11

# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

SOURCES += \
    main.cpp \
    mainwindow.cpp

HEADERS += \
    mainwindow.h

FORMS += \
    mainwindow.ui

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

# 添加windows的配置,这里不管你是win32 还是 win64 ,都是统一使用 win32
win32 {

    FFMPEG_HOME = ../ffmpeg-6.0-full_build-shared
    SDL_HOME = ../SDL2-devel-2.0.14-mingw/SDL2-2.0.14/x86_64-w64-mingw32


#INCLUDEPATH += 的意思是再原先的INCLUDEPATH的基础上,再添加等号后面的值 $${SDL_HOME}的意思是从 SDL_HOME中取出值,也就是 ../sdl,
#连起来看,这句话的意思是,给原先的  INCLUDEPATH ,再加上 当前.pro文件的上一级目录下的/sdl/include
#INCLUDEPATH 的意思是添加 .h文件
INCLUDEPATH += $${SDL_HOME}/include/SDL2 \
            $${FFMPEG_HOME}/include


#LIBS 的意思是添加静态库和动态库的访问路径,
LIBS += -L$${SDL_HOME}/lib \
        -L$${FFMPEG_HOME}/lib \
            -lavcodec \
            -lavdevice \
            -lavfilter \
            -lavformat \
            -lavutil \
            -lpostproc \
            -lswscale \
            -lswresample \
            -lsdl2


# message()可以用来打印
message(11111111111)
message($${SDL_HOME})
message($${FFMPEG_HOME})
message($$(PATH))
}


mac {
    FFMPEG_HOME = /usr/local/Cellar/ffmpeg/4.3.2
    SDL_HOME = /usr/local/Cellar/SDL2-devel-2.0.14-mingw/SDL2-2.0.14/

    INCLUDEPATH += $${SDL_HOME}/include/SDL2 \
            $${FFMPEG_HOME}/include


    #LIBS 的意思是添加静态库和动态库的访问路径,
    LIBS += -L$${SDL_HOME}/lib \
            -L$${FFMPEG_HOME}/lib \
                -lavcodec \
                -lavdevice \
                -lavfilter \
                -lavformat \
                -lavutil \
                -lpostproc \
                -lswscale \
                -lswresample \
                -lsdl2
}

# 库文件路径
#mac:INCLUDEPATH += $${FFMPEG_HOME}/include

# 需要链接哪些库?默认是链接动态库
#mac:LIBS += -L $${FFMPEG_HOME}/lib \

message()方法可以在.pro文件中 打印相关信息

复制代码
# message()可以用来打印
message(11111111111)
message($${SDL_HOME})
message($${FFMPEG_HOME})
message($$(PATH))
可以看到message 打印相关的信息 是在 QT 的 "概要信息" 中的。

我们将信息分析如下:

复制代码
Project MESSAGE: 11111111111
Project MESSAGE: ../SDL2-devel-2.0.14-mingw/SDL2-2.0.14/x86_64-w64-mingw32
Project MESSAGE: ../ffmpeg-6.0-full_build-shared

/// PATH 信息,前三行为QT 安装的path,下来是 系统变量, 最后三行是Anminister的用户变量
Project MESSAGE: C:\Qt\Qt5.14.2\Tools\mingw730_64\bin;
C:\Qt\Qt5.14.2\5.14.2\mingw73_64\bin;
C:\Qt\Qt5.14.2\Tools\mingw730_64\bin;


D:\Ctool\ffmpeg-4.2.1-win32-shared\bin;
C:\Program Files (x86)\VMware\VMware Workstation\bin\;
D:\Ctool\yinshipin\ffmpeg-6.0-full_build-shared\bin;
C:\Program Files\Microsoft MPI\Bin\;
C:\Program Files (x86)\Common Files\Oracle\Java\javapath;
C:\windows\system32;
C:\windows;
C:\windows\System32\Wbem;
C:\windows\System32\WindowsPowerShell\v1.0\;
C:\windows\System32\OpenSSH\;
C:\Program Files\dotnet\;
C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;
C:\Program Files\IDM Computer Solutions\UltraEdit;
C:\Program Files\Git\cmd;
C:\Program Files\TortoiseGit\bin;
D:\Ctool\SDL2-devel-2.0.14-mingw\SDL2-2.0.14\x86_64-w64-mingw32\bin;
D:\Ctool\x86_64-8.1.0-release-win32-seh-rt_v6-rev0\mingw64\bin;
C:\Program Files\CMake\bin;
D:\Ctool\protobuf\protobuf-windows\bin;
D:\Ctool\protobuf\protobuf-windows\lib;
C:\Program Files\Java\jdk1.8.0_241\bin;
C:\Program Files\Microsoft VS Code\bin;
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64;
D:\Ctool\SDL2-devel-2.0.14-mingw\SDL2-2.0.14\x86_64-w64-mingw32\bin;
C:\Program Files\OpenSSL-Win64\bin;

C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;
C:\Users\Administrator\.dotnet\tools;
C:\Program Files\JetBrains\CLion 2023.3.4\bin;

3.注意的问题

我们在这里 加载了 ffmpeg 库,加载了sdl的库,要注意的是:在加载多个第三方库的时候,INCLUDEPATH,LIBS时,只能写一个,不能写多个,否则build fail。

复制代码
INCLUDEPATH += $${SDL_HOME}/include/SDL2 \
            $${FFMPEG_HOME}/include


    #LIBS 的意思是添加静态库和动态库的访问路径,
    LIBS += -L$${SDL_HOME}/lib \
            -L$${FFMPEG_HOME}/lib \
                -lavcodec \
                -lavdevice \
                -lavfilter \
                -lavformat \
                -lavutil \
                -lpostproc \
                -lswscale \
                -lswresample \
                -lsdl2
相关推荐
合尘猫7 小时前
用 6GB 显卡搭短视频产线:MiniMax H3 + ffmpeg 全流程实录(55 秒片 / 40 分钟)
人工智能·音视频
the3clipse2 天前
Windows 11 26H2 声音与音频问题排查指南:没声音、麦克风不收音与蓝牙音频优化
音视频·le audio·windows 11 26h2·win11没声音·麦克风没声音·蓝牙耳机音质·音频服务修复
开开心心就好2 天前
PDF水印怎么去掉?勾选对象再点匹配
java·前端·mysql·支持向量机·pdf·音视频·模拟退火算法
RobinDevNotes3 天前
Claude Code 剪视频,不上传、不要 API Key
人工智能·python·音视频·开发工具·ipython
伯奥克客服3 天前
2026年视频综合一体机架构选型:从接口协议到流媒体底层的深度技术解析
架构·音视频
开开心心就好3 天前
两张表格数据对比工具,不用写函数也能查
算法·spring·智能手机·pdf·电脑·intellij-idea·音视频
FansAI_art3 天前
多角色 AIGC 短片的双模型分工:静态生图与图生视频怎么接
aigc·音视频
山顶夕景4 天前
【ECCV2026】流式视频理解Thinking in Streaming Video
音视频·vlm·视频理解·多模态理解·流式视频
zhanlang02175 天前
HTML 零基础入门到企业实战【第五章 5.4】内嵌网页 iframe 标签:嵌入网页、视频、地图实战
前端·html·音视频
TengTaiTech5 天前
头戴耳机做运动相机外接麦:一颗麦克风同时服务蓝牙通话与 3.5mm 录音的底层重构
数码相机·音视频·蓝牙·qcc