Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDL1/2: Compiler error with png/Image #1529

Closed
raziel- opened this issue Mar 11, 2019 · 8 comments

Comments

@raziel-
Copy link
Contributor

commented Mar 11, 2019

C++      backends/graphics/openglsdl/openglsdl-graphics.o

In file included from ./image/png.h:36,
from backends/graphics/openglsdl/openglsdl-graphics.cpp:40:
./image/image_decoder.h:37:11: error: 'namespace Image { }' redeclared as different kind of symbol
namespace Image {
^~~~~
In file included from /SDK/local/common/include/mgl/context.h:27,
from /SDK/local/common/include/mgl/gl.h:74,
from /SDK/local/common/include/GL/gl.h:1925,
from /SDK/local/newlib/include/SDL2/SDL_opengl.h:43,
from ./graphics/opengl/system_headers.h:52,
from ./graphics/opengl/framebuffer.h:26,
from backends/graphics/openglsdl/openglsdl-graphics.cpp:35:
/SDK/include/include_h/intuition/intuition.h:754:8: note: previous declaration 'struct Image'
struct Image
^~~~~
In file included from backends/graphics/openglsdl/openglsdl-graphics.cpp:40:
./image/png.h:47:11: error: 'namespace Image { }' redeclared as different kind of symbol
namespace Image {
^~~~~
In file included from /SDK/local/common/include/mgl/context.h:27,
from /SDK/local/common/include/mgl/gl.h:74,
from /SDK/local/common/include/GL/gl.h:1925,
from /SDK/local/newlib/include/SDL2/SDL_opengl.h:43,
from ./graphics/opengl/system_headers.h:52,
from ./graphics/opengl/framebuffer.h:26,
from backends/graphics/openglsdl/openglsdl-graphics.cpp:35:
/SDK/include/include_h/intuition/intuition.h:754:8: note: previous declaration 'struct Image'
struct Image
^~~~~
backends/graphics/openglsdl/openglsdl-graphics.cpp: In member function 'virtual bool OpenGLSdlGraphicsManager::saveScreenshot(const Common::String&) const':
backends/graphics/openglsdl/openglsdl-graphics.cpp:685:16: error: 'writePNG' is not a member of 'Image'
return Image::writePNG(out, data, true);
^~~~~~~~
gmake: *** [backends/graphics/openglsdl/openglsdl-graphics.o] Error 1

I got this after switching from gcc 8.1.0 to 8.3.0

I haven't tried the ScummVM chain yet (need to check if there is the same(similar error)

gcc (adtools build 8.3.0) 8.3.0
AmigaOS4 - PPC - SDL2 - BE

@raziel-

This comment has been minimized.

Copy link
Contributor Author

commented Mar 13, 2019

Seems to be the new addition for saving screenshots has introduced this error (but that's just guesswork).

ScummVM builds fine

@raziel-

This comment has been minimized.

Copy link
Contributor Author

commented Mar 22, 2019

Bisected the last commits.

d4d6e62 is the one introducing the error
d4d6e62

@raziel- raziel- changed the title Compiler error with gcc 8.3.0 SDL1/2: Compiler error with png/Image Mar 22, 2019
@raziel-

This comment has been minimized.

Copy link
Contributor Author

commented Mar 22, 2019

I just did a triple check by trying to build the program with using SDL1, SDL2 and OpenGLES2.

SDL1 and 2 break, OpenGLES2 does not, so it´s a sole problem of the SDL part

@bgK

This comment has been minimized.

Copy link
Member

commented Mar 25, 2019

Whoever is in charge of this part of the AmigaOS SDK needs to be notified it's not a good idea to name their things Image and such as it's bound to conflict with application code...

@raziel-

This comment has been minimized.

Copy link
Contributor Author

commented Mar 30, 2019

quote:
That struct Image predates SDL by many years, and there's plenty of code that would break if it were changed.

@raziel-

This comment has been minimized.

Copy link
Contributor Author

commented Mar 31, 2019

What i find really strange is, that it works with ScummVM.
As far as i can see the structure of the file is the same in both ResidualVM; and ScummVM.

@raziel-

This comment has been minimized.

Copy link
Contributor Author

commented May 25, 2019

Since i probably have a fix for this (in SDL tree of AmigaOS) i tried to build residualvm with PNG enabled and encountered a different (but similar) problem.
(Reverting the PNG fix from 119ff7f didn't help)

    C++      backends/graphics/surfacesdl/surfacesdl-graphics.o
backends/graphics/surfacesdl/surfacesdl-graphics.cpp: In member function 'virtual bool SurfaceSdlGraphicsManager::saveScreenshot(const Common::String&) const':
backends/graphics/surfacesdl/surfacesdl-graphics.cpp:512:13: error: 'width' was not declared in this scope
   data.init(width, height, screen->pitch, screen->pixels, format);
             ^~~~~
backends/graphics/surfacesdl/surfacesdl-graphics.cpp:512:20: error: 'height' was not declared in this scope
   data.init(width, height, screen->pitch, screen->pixels, format);
                    ^~~~~~
backends/graphics/surfacesdl/surfacesdl-graphics.cpp:512:20: note: suggested alternative: 'sig_t'
   data.init(width, height, screen->pitch, screen->pixels, format);
                    ^~~~~~
                    sig_t
gmake: *** [backends/graphics/surfacesdl/surfacesdl-graphics.o] Error 1
@Botje

This comment has been minimized.

Copy link
Member

commented Aug 5, 2019

This was fixed in #1546 , I believe? Please reopen if not.

@Botje Botje closed this Aug 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.