新建一个vc6工程,怎么用libx264.lib,需要哪些辅助文件

把libx264.lib拷到当前工程目录下,并把extrasextras文件夹拷过来

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

#include "extras/stdint.h"
#include "x264.h"

如果没有#include "extras/stdint.h"
编译会提示如下

You must include stdint.h or inttypes.h before x264.h
d:\client\x264.h(161) : error C2146: syntax error : missing ';' before identifier 'cqm_4iy'
d:\client\x264.h(161) : error C2501: 'uint8_t' : missing storage-class or type specifiers
d:\client\x264.h(161) : error C2501: 'cqm_4iy' : missing storage-class or type specifiers
d:\client\x264.h(162) : error C2146: syntax error : missing ';' before identifier 'cqm_4ic'
d:\client\x264.h(162) : error C2501: 'uint8_t' : missing storage-class or type specifiers
d:\client\x264.h(162) : error C2501: 'cqm_4ic' : missing storage-class or type specifiers
d:\client\x264.h(163) : error C2146: syntax error : missing ';' before identifier 'cqm_4py'
d:\client\x264.h(163) : error C2501: 'uint8_t' : missing storage-class or type specifiers
d:\client\x264.h(163) : error C2501: 'cqm_4py' : missing storage-class or type specifiers
d:\client\x264.h(164) : error C2146: syntax error : missing ';' before identifier 'cqm_4pc'
d:\client\x264.h(164) : error C2501: 'uint8_t' : missing storage-class or type specifiers
d:\client\x264.h(164) : error C2501: 'cqm_4pc' : missing storage-class or type specifiers
d:\client\x264.h(165) : error C2146: syntax error : missing ';' before identifier 'cqm_8iy'
d:\client\x264.h(165) : error C2501: 'uint8_t' : missing storage-class or type specifiers
d:\client\x264.h(165) : error C2501: 'cqm_8iy' : missing storage-class or type specifiers
d:\client\x264.h(166) : error C2146: syntax error : missing ';' before identifier 'cqm_8py'
d:\client\x264.h(166) : error C2501: 'uint8_t' : missing storage-class or type specifiers
d:\client\x264.h(166) : error C2501: 'cqm_8py' : missing storage-class or type specifiers
d:\client\x264.h(282) : error C2143: syntax error : missing ';' before '*'
d:\client\x264.h(282) : error C2501: 'uint8_t' : missing storage-class or type specifiers
d:\client\x264.h(282) : error C2501: 'plane' : missing storage-class or type specifiers
d:\client\x264.h(293) : error C2146: syntax error : missing ';' before identifier 'i_pts'
d:\client\x264.h(293) : error C2501: 'int64_t' : missing storage-class or type specifiers
d:\client\x264.h(293) : error C2501: 'i_pts' : missing storage-class or type specifiers
d:\client\x264.h(341) : error C2143: syntax error : missing ';' before '*'
d:\client\x264.h(341) : error C2501: 'uint8_t' : missing storage-class or type specifiers
d:\client\x264.h(341) : error C2501: 'p_payload' : missing storage-class or type specifiers
D:\Client\ClientDlg.cpp(306) : warning C4244: '=' : conversion from 'long' to 'unsigned short', possible loss of data

实际上,x264源文件中,我并没有搜索到inttypes.h,只是在extras文件夹下有stdint.h

 

stdint.h中的内容都是一些typedef语句,形如下面之类:
/* 7.18.1.1  Exact-width integer types */
typedef signed char int8_t;
typedef unsigned char   uint8_t;
typedef short  int16_t;
typedef unsigned short  uint16_t;
typedef int  int32_t;
typedef unsigned   uint32_t;
typedef __int64  int64_t;
typedef unsigned __int64 uint64_t;

 在本文开始编译时有一句提示“You must include stdint.h or inttypes.h before x264.h”,这个在x264中的对应代码为:

#if !defined(_STDINT_H) && !defined(_STDINT_H_) && \
    !defined(_INTTYPES_H) && !defined(_INTTYPES_H_)
 # ifdef _MSC_VER
  #  pragma message("You must include stdint.h or inttypes.h before x264.h")
 # else
  #  warning You must include stdint.h or inttypes.h before x264.h
 # endif
#endif

在stdint.h中的对应代码为:


#ifndef _STDINT_H
#define _STDINT_H
#define __need_wint_t
#define __need_wchar_t

 

这样你就可以在程序中定义x264.h里的类型了:

 

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

#include "extras/stdint.h"
#include "x264.h"

... ...

void CClientDlg::OnBtnStartcap()
{
 // TODO: Add your control notification handler code here

 x264_param_t dsds;//x264.h里的一种数据类型
}

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值