Discussion:
KDE and SDL2: some problem with syntax analyser
Luca Provenzani
2018-11-21 07:37:58 UTC
Permalink
Hi all,

first of all it is right to say that I'm newbie on kdevelop, C++ and
SDL. Than the question:

I begin to setting up a new project with SDL2 and all is ok, I can
compile, execute and so on. But there is an annoying thing: the language
support doesn't work well. It highlights a lot of error and doesn't
suggest properly, not recognising some SDL function or struct.

The strange thing is that some function like
"SDL_CreateTextureFromSurface" is recognized other not, like
"SDL_LoadBMP" or struct like "SDL_Texture".

I attach a screenshot showing that.

In the included file SDL_Renderer.h I see:/
/

//**/
/ *  \brief An efficient driver-specific representation of pixel data/
/ *//
/struct SDL_Texture;/
/typedef struct SDL_Texture SDL_Texture;/

without an explicit definition of the struct..

Do some one know how to fix this behaviour?

Thanks

Best Regards

Luca
René J.V. Bertin
2018-11-21 10:10:03 UTC
Permalink
Hi,

Please have a look at the recent thread "KDevelop syntax parser is barely usable" on this same mailing list, I think you will find answers there.

Are you working on a project of your own or on an existing project? If this is a project you're designing from start (or taking over) your best option is to make it use CMake instead of `configure` (aka automake and autoconf). Write a cmake file that describes how your project is to be built and make sure it finds the SDL version you use. Then import your project into KDevelop using that CMakeLists.txt file. Your problems should go away.

R.
Kevin Funk
2018-11-21 10:46:20 UTC
Permalink
Post by René J.V. Bertin
Hi,
Please have a look at the recent thread "KDevelop syntax parser is barely
usable" on this same mailing list, I think you will find answers there.
Please don't. The thread is too noisy and will likely only confuse you more.
Post by René J.V. Bertin
Are you working on a project of your own or on an existing project? If this
is a project you're designing from start (or taking over) your best option
is to make it use CMake instead of `configure` (aka automake and autoconf).
Write a cmake file that describes how your project is to be built and make
sure it finds the SDL version you use. Then import your project into
KDevelop using that CMakeLists.txt file. Your problems should go away.
If you look at his screenshot: He's already using CMake.

Regards,
Kevin
Post by René J.V. Bertin
R.
--
Kevin Funk | ***@kde.org | http://kfunk.org
Kevin Funk
2018-11-21 10:55:17 UTC
Permalink
Post by Luca Provenzani
Hi all,
first of all it is right to say that I'm newbie on kdevelop, C++ and
I begin to setting up a new project with SDL2 and all is ok, I can
compile, execute and so on. But there is an annoying thing: the language
support doesn't work well. It highlights a lot of error and doesn't
suggest properly, not recognising some SDL function or struct.
Hey Luca,

so as I take it the SDL2 headers are properly found and you can "jump into"
(i.e. Ctrl+Click on "#include <SDL2/SDL.h>") them, right?
Post by Luca Provenzani
The strange thing is that some function like
"SDL_CreateTextureFromSurface" is recognized other not, like
"SDL_LoadBMP" or struct like "SDL_Texture".
In your case it looks like none of the function mentioned could be found
(they're not colored in blue, like e.g. "SDL_GetError()").

In case only some functions are not detected, then the problems is likely that
their declaration is could not be parsed properly. Could you jump into SDL.h
or SDL_surface.h and check whether SDL_LoadBMP/SDL_LoadBMP_RW could not be
parsed properly?

To me it looks like all the structs like SDL_Texture/SDL_Surface cannot be
parsed and thus cause follow up errors everywhere.

Regards,
Kevin
Post by Luca Provenzani
I attach a screenshot showing that.
In the included file SDL_Renderer.h I see:/
/
//**/
/ * \brief An efficient driver-specific representation of pixel data/
/ *//
/struct SDL_Texture;/
/typedef struct SDL_Texture SDL_Texture;/
without an explicit definition of the struct..
Do some one know how to fix this behaviour?
Thanks
Best Regards
Luca
--
Kevin Funk | ***@kde.org | http://kfunk.org
Kevin Funk
2018-11-21 10:56:18 UTC
Permalink
Post by Kevin Funk
Post by Luca Provenzani
Hi all,
first of all it is right to say that I'm newbie on kdevelop, C++ and
I begin to setting up a new project with SDL2 and all is ok, I can
compile, execute and so on. But there is an annoying thing: the language
support doesn't work well. It highlights a lot of error and doesn't
suggest properly, not recognising some SDL function or struct.
Hey Luca,
so as I take it the SDL2 headers are properly found and you can "jump into"
(i.e. Ctrl+Click on "#include <SDL2/SDL.h>") them, right?
Post by Luca Provenzani
The strange thing is that some function like
"SDL_CreateTextureFromSurface" is recognized other not, like
"SDL_LoadBMP" or struct like "SDL_Texture".
In your case it looks like none of the function mentioned could be found
(they're not colored in blue, like e.g. "SDL_GetError()").
In case only some functions are not detected, then the problems is likely
that their declaration is could not be parsed properly. Could you jump into
SDL.h or SDL_surface.h and check whether SDL_LoadBMP/SDL_LoadBMP_RW could
not be parsed properly?
To me it looks like all the structs like SDL_Texture/SDL_Surface cannot be
parsed and thus cause follow up errors everywhere.
Btw: If you could share the project (i.e. by zipping it up and sending it
here), that'd help a lot!

Regards,
Kevin
Post by Kevin Funk
Regards,
Kevin
Post by Luca Provenzani
I attach a screenshot showing that.
In the included file SDL_Renderer.h I see:/
/
//**/
/ * \brief An efficient driver-specific representation of pixel data/
/ *//
/struct SDL_Texture;/
/typedef struct SDL_Texture SDL_Texture;/
without an explicit definition of the struct..
Do some one know how to fix this behaviour?
Thanks
Best Regards
Luca
--
Kevin Funk | ***@kde.org | http://kfunk.org
Loading...