rust win跨平台编译Linux,Qt 中跨平台(win/linux)编译

做个小笔记,记录一下Qt中 windows 的 32位与 64位 以及 linux 平台下通用的 pro 文件书写方式。

文件中设计的bin、include、lib、src 目录请看

以下是 pro 文件:

TEMPLATE = app

CONFIG += console c++11

SOURCES += main.cpp

INCLUDEPATH += $$PWD/../../include

win32{

#区分32位和64位windows程序

opt = $$find(QMAKESPEC,"msvc2015_64")

isEmpty(opt){

message("win32 lib")

LIBS += -L$$PWD/../../lib/win32

}

!isEmpty(opt){

message("win64 lib")

LIBS += -L$$PWD/../../lib/win64

}

}

#linux

linux{

message("linux")

LIBS += -L$$PWD/../../lib -lxxxxx

}

#message($$QMAKESPEC)、

代码中跨平台调用

#include

using namespace std;

//要引用c语言函数

extern "C"{

#include

}

//预处理指令导入库

#pragma comment(lib,"avcodec.lib")

int main(int argc,char *argv[])

{

//显示ffmpeg的编译配置

cout << "Test FFmpeg.club" << endl;

#ifdef _WIN32 //32位和64位 win

#ifdef _WIN64 //64位 win

cout << "Windows X64" << endl;

#else

cout << "Windows X86" << endl;

#endif

#else

cout << "Linux" << endl;

#endif

cout << avcodec_configuration() << endl;

getchar();

return 0;

}

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值