1

好的,所以我想使用 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.hgchar在那里定义)-也在任何其他包括之前
  • 重新声明`_GstElement gst_pipeline_new(const gchar* name)'

这些都没有帮助...

对我来说,Eclipse 似乎没有看到该gchar类型,因为它说候选人是_GstElement * gst_pipeline_new(const ? *)Where?替换了真实类型。但我不知道如何制作(或事件强制:))Eclipse 来查看它......

4

2 回答 2

2

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

您可以将它们添加到 'Project->Properties->C++ General->Paths and Symbols'

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

于 2013-11-22T10:53:34.280 回答
1

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

转到 Window->Preferences->C/C++->Indexer tab cache limits 并增加(可能取决于机器):

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

Header file cache:
Absolute Limit: 128 MB
于 2013-11-25T15:10:58.510 回答