문제

Ok, so I want to use gstreamer library.

1. Situation

I have some code:

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

Where gst_pipeline_new is declared in gstpipeline.h:

GstElement* gst_pipeline_new (const gchar* name) G_GNUC_MALLOC;

where non obvious "things" :) are defined somewhere in the system:

typedef struct _GstElement GstElement;             // gstelement.h
typedef char   gchar;                              // gtypes.h
#define G_GNUC_MALLOC  __attribute__((__malloc__)) // gmacros.h

2. Problem

Since I use make for building I have no errors during compilation and linking. Program itself runs OK as well. However... In Eclipse IDE I have the following error:

Description Resource Path Location Type
Invalid arguments '
Candidates are:
_GstElement * gst_pipeline_new(const ? *)
' file.cc /path/to/file line 106 Semantic Error

I added all include directories which are specified in Makefile to eclipse project configuration (Project->Properties->C/C++ General->Paths and Symbols->Includes->C++). Of course it's a C++ project.

3. Question

How to get rid of that Eclipse error? I have no clue how to do this... And it drives me mad since now I use some legacy code and I have around 100 errors like this one.

So far I've tried:

  • casting either by reinterpret_cast<>() or C-like casting to const gchar*
  • adding typedef char gchar at the beginning of the file - before any other include!
  • including gtypes.h (gchar is defined there) - also before any other include
  • redeclaring `_GstElement gst_pipeline_new(const gchar* name)'

Nither of those helped...

To me it looks like Eclipse does not see the gchar type since it says that the candidate is _GstElement * gst_pipeline_new(const ? *) Where ? substitutes the real type. But I have no idea how to make (or event force :)) Eclipse to see it...

도움이 되었습니까?

해결책 2

As g-maulik suggested, It seems that it was really an indexer problem. After increasing the indexer cache limits everything works fine.

Go to Window->Preferences->C/C++->Indexer tab cache limits and increase (might be machine dependent):

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

Header file cache:
Absolute Limit: 128 MB

다른 팁

Most probably eclipse just doesn't know about your include paths (for this specific library) and complains about the unindexed types and declarations.

You can add them under 'Project->Properties->C++ General->Paths and Symbols'

If this doesn't help, you can also switch off semantic error checking (see Code Analysis), either in whole or for particular error types.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top