1
General discussions / Re: SFML Game Development by Example - 4th SFML book
« on: December 01, 2019, 06:46:52 am »Hey OrderNexus,
Finally finishing up the Networking Portion of the book and I've run into a snag with the Chapter 14 code. When I compile the code for the Client, I get the following errors everywhere an instance of the Shared Context is referenced.
Output (VS2017)1>c:\src\sfml-2.4.2\include\sfml\network\sockethandle.hpp(46): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\src\sfml-2.4.2\include\sfml\network\sockethandle.hpp(46): error C2146: syntax error: missing ';' before identifier 'SocketHandle'
1>c:\src\sfml-2.4.2\include\sfml\network\socket.hpp(140): error C3646: 'getHandle': unknown override specifier
1>c:\src\sfml-2.4.2\include\sfml\network\socket.hpp(140): error C2059: syntax error: '('
1>c:\src\sfml-2.4.2\include\sfml\network\socket.hpp(140): error C2238: unexpected token(s) preceding ';'
1>c:\src\sfml-2.4.2\include\sfml\network\socket.hpp(159): error C2061: syntax error: identifier 'SocketHandle'
1>c:\src\sfml-2.4.2\include\sfml\network\socket.hpp(159): error C2535: 'void sf::Socket::create(void)': member function already defined or declared
1>c:\src\sfml-2.4.2\include\sfml\network\socket.hpp(148): note: see declaration of 'sf::Socket::create'
1>c:\src\sfml-2.4.2\include\sfml\network\socket.hpp(177): error C3646: 'm_socket': unknown override specifier
1>c:\src\sfml-2.4.2\include\sfml\network\socket.hpp(177): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
The culprit seems to be in the SocketHandle.hpp (SFML/Networking) with the following line of code:#if defined(SFML_SYSTEM_WINDOWS)
typedef UINT_PTR SocketHandle;
#else
I've determined that the problem is coming from the Client somewhere, and yet when I run the same code in Chapter 13, it works as intended. Odd.
I was hoping to finish this chapter before moving onto your next book (Mastering SFML).
Q1: Any ideas how I can fix this? Are there any changes you are aware of in SFML since 2.4 in Networking?
Q2: Is the Networking module for SFML needed in Mastering SFML?
I'd like to get the code working as intended
Thank you!
Q2: networking isn't covered at all in the "Mastering" title.
This is still a problem...it doesn't have anything to do with the Shared Context. Something is wrong with the S_Network...the strange thing is that the Chapter 13 project works fine.
Furthermore, I'm seeing some other problems...there seems to be another error with Rect.inl in the API and this project. Fortunately, it isn't necessary for the next book but it would be nice to get it implemented successfully.
If I had to guess at the moment (I don't have the source code available), I'd say this is probably some kind of include order issue. I vaguely recall running into something like this in conjunction with some windows-specific includes, specifically in "Utilities.h". I might be completely wrong, but I can't verify this at the moment. Does anyone else have memory of / experience with this type of issue?