4
我定义下面的头文件(在C)中,留出了功能的实现,因为thise不需要:调用从C++ C函数,“不匹配函数”错误
#ifndef FFMPEG_MEDIAMETADATARETRIEVER_H_
#define FFMPEG_MEDIAMETADATARETRIEVER_H_
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/dict.h>
int setDataSource(AVFormatContext** pFormatCtx, const char* path);
#endif /*FFMPEG_MEDIAMETADATARETRIEVER_H_*/
在C++中中,我定义我的第二报头的文件:
#ifndef MEDIAMETADATARETRIEVER_H
#define MEDIAMETADATARETRIEVER_H
using namespace std;
extern "C" {
#include "ffmpeg_mediametadataretriever.h"
}
class MediaMetadataRetriever
{
public:
MediaMetadataRetriever();
~MediaMetadataRetriever();
int setDataSource(const char* dataSourceUrl);
};
#endif // MEDIAMETADATARETRIEVER_H
在,mediametadataretriever.cpp我定义下面的函数:
int MediaMetadataRetriever::setDataSource(
const char *srcUrl)
{
// should call C function
AVFormatContext* pFormatCtx;
return setDataSource(&pFormatCtx, srcUrl);
}
W¯¯母鸡我尝试编译在Eclipse这个(C++)项目中,我得到一个“没有匹配函数的调用...”相关的错误:
return setDataSource(&pFormatCtx, srcUrl);
如果我注释掉调用,代码编译好:
int MediaMetadataRetriever::setDataSource(
const char *srcUrl)
{
return 0;
}
这似乎是一个链接的问题,没有人知道我在做什么错?
@WilliamSeemann:好的,很高兴它帮助:) – 2013-03-15 20:05:26