0
\$\begingroup\$

I have been following the "SFML Game Development By Example" and on chapter 2, the book was showing the example game design of a Snake game. However he didn't write the code of some header classes and didn't mention whether they should exist. I tried writing some of them but encountered an error:

sf::RenderWindow* Window::GetRenderWindow(return &m_window;)

Error: declaration is incompatible with sf::RenderWindow *Window::GetRenderWindow()

In my Window class:

class Window{

public:
    ...
    sf::RenderWindow* GetRenderWindow();
    ...
private:
    ...
    sf::RenderWindow m_window;
    ...
}

I think it is probably because of the function declaration.

\$\endgroup\$

1 Answer 1

0
\$\begingroup\$

sorry for the silly question. It is time to sleep I guess. Here is the corrected version:

sf::RenderWindow* Window::GetRenderWindow() {
    return &m_window;
}
\$\endgroup\$
1
  • \$\begingroup\$ Don't forget to come back and mark this answer as accepted when it's possible :) \$\endgroup\$
    – Vaillancourt
    Feb 27, 2018 at 2:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .