好的,所以我想使用 gstreamer 库。
一、情况
我有一些代码:
#include <gst/gstpipeline.h>
#include <gst/gst.h>
...
GstElement* pipe = gst_pipeline_new("PipeName");
在gstpipeline.hgst_pipeline_new
中声明的位置:
GstElement* gst_pipeline_new (const gchar* name) G_GNUC_MALLOC;
其中不明显的“事物”:) 在系统中的某处定义:
typedef struct _GstElement GstElement; // gstelement.h
typedef char gchar; // gtypes.h
#define G_GNUC_MALLOC __attribute__((__malloc__)) // gmacros.h
2.问题
由于我使用 make 进行构建,因此在编译和链接期间没有错误。程序本身也可以正常运行。但是...在 Eclipse IDE 中出现以下错误:
Description Resource Path Location Type
Invalid arguments '
Candidates are:
_GstElement * gst_pipeline_new(const ? *)
' file.cc /path/to/file line 106 Semantic Error
我将 Makefile 中指定的所有包含目录添加到 Eclipse 项目配置(Project->Properties->C/C++ General->Paths and Symbols->Includes->C++)。当然,这是一个 C++ 项目。
3. 问题
如何摆脱那个 Eclipse 错误?我不知道该怎么做……这让我很生气,因为现在我使用了一些遗留代码,并且我有大约 100 个像这样的错误。
到目前为止,我已经尝试过:
- 通过
reinterpret_cast<>()
或类似 C 的强制转换为const gchar*
typedef char gchar
在文件开头添加- 在任何其他包含之前!- 包括
gtypes.h
(gchar
在那里定义)-也在任何其他包括之前 - 重新声明`_GstElement gst_pipeline_new(const gchar* name)'
这些都没有帮助...
对我来说,Eclipse 似乎没有看到该gchar
类型,因为它说候选人是_GstElement * gst_pipeline_new(const ? *)
Where?
替换了真实类型。但我不知道如何制作(或事件强制:))Eclipse 来查看它......