Eclipse使用gstreamer时出现无效的参数错误

时间:2013-11-22 10:16:55

标签: c++ c eclipse gstreamer invalid-argument

好的,所以我想使用gstreamer库。

1。情况

我有一些代码:

#include <gst/gstpipeline.h>
#include <gst/gst.h>
...
GstElement* pipe = gst_pipeline_new("PipeName");

在gstpipeline.h中声明gst_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项目配置指定的所有include目录(Project-&gt; Properties-&gt; C / C ++ General-&gt; Paths and Symbols-&gt; Includes-&gt; C ++)。当然这是一个C ++项目。

3。问题

如何摆脱Eclipse错误?我不知道如何做到这一点...它让我很生气,因为现在我使用了一些遗留代码,我有大约100个像这样的错误。

到目前为止,我已经尝试过:

  • 通过reinterpret_cast<>()或类似C的转换投射到const gchar*
  • 在文件开头添加typedef char gchar - 在任何其他包含之前添加!
  • 包括gtypes.hgchar在那里定义) - 也在任何其他包含
  • 之前
  • 重新声明`_GstElement gst_pipeline_new(const gchar * name)'

这些都没有帮助......

对我而言,Eclipse似乎没有看到gchar类型,因为它表示候选者是_GstElement * gst_pipeline_new(const ? *)其中?替换了真实类型。但我不知道如何让Eclipse(或事件强制:))Eclipse看到它......

2 个答案:

答案 0 :(得分:2)

很可能eclipse只是不知道你的包含路径(针对这个特定的库)并抱怨未编入索引的类型和声明。

您可以在'Project-&gt; Properties-&gt; C ++ General-&gt; Paths and Symbols'下添加它们

如果这没有帮助,您还可以关闭整个或特定错误类型的语义错误检查(请参阅代码分析)。

答案 1 :(得分:1)

正如g-maulik建议的那样,它似乎真的是一个索引器问题。增加索引器缓存限制后,一切正常。

转到Window-&gt; Preferences-&gt; C / C ++ - &gt; Indexer选项卡缓存限制和增加(可能取决于机器):

Index Database cache:
Limit relative to the maximum heap size: 15%
Absolute limit: 128 MB

Header file cache:
Absolute Limit: 128 MB