c++ - 使用 gstreamer 时出现 Eclipse 无效参数错误

标签 c++ c eclipse gstreamer invalid-argument

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

1。情况

我有一些代码:

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

在哪里gst_pipeline_new在 gstpipeline.h 中声明:

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 项目配置(项目->属性->C/C++ 常规->路径和符号->包含->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 ? *)在哪里?替代真实类型。但我不知道如何制作(或事件力 :))Eclipse 来查看它...

最佳答案

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

您可以在“项目->属性->C++ 通用->路径和符号”下添加它们

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

关于c++ - 使用 gstreamer 时出现 Eclipse 无效参数错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20142337/

相关文章:

c++ - 不确定如何在 main() 中将参数从类传递到构造函数

c++ - __memcpy_ssse3() 段错误

c - 奇怪的宏结构

c - 从另一个 block 内增加变量

eclipse - 无法计算构建计划 : Could not find artifact org. apache.maven.plugins :maven-resources-plugin:jar:2. 4.3

Eclipse for Visual Studio 傻瓜

c++ - 模拟退火算法

c++ - 提升 iterator_facade 和前向声明

c - 如何在 C 程序中声明一个 unsigned int

java - 创建 Maven 项目,无法解析原型(prototype),连接被拒绝