C++ Winsock Networking Tutorials [04-24-2017]

The Partridge Family were neither partridges nor a family. Discuss.
egizz983
Posts: 311
Joined: August 27th, 2016, 12:30 pm

Re: C++ Winsock Networking Tutorials [11-16-2016]

Post by egizz983 » November 18th, 2016, 10:36 pm

Oh yea and then i could just make client inside a game object and make a function to get a pointer to client , and should i worry about all those warnings ?

Pindrought
Posts: 432
Joined: September 26th, 2013, 4:57 pm
Location: Kentucky
Contact:

Re: C++ Winsock Networking Tutorials [11-16-2016]

Post by Pindrought » November 18th, 2016, 10:47 pm

egizz983 wrote:Oh yea and then i could just make client inside a game object and make a function to get a pointer to client , and should i worry about all those warnings ?
I'm not getting any warnings related to the client when I compile it.
PM me if you need to contact me. Thanks to all the helpful people on this forum especially to Chili.

egizz983
Posts: 311
Joined: August 27th, 2016, 12:30 pm

Re: C++ Winsock Networking Tutorials [11-16-2016]

Post by egizz983 » November 18th, 2016, 10:51 pm

Could u upload me that solution ?

Pindrought
Posts: 432
Joined: September 26th, 2013, 4:57 pm
Location: Kentucky
Contact:

Re: C++ Winsock Networking Tutorials [11-16-2016]

Post by Pindrought » November 18th, 2016, 11:12 pm

Sorry just saw your post. I edited the original post where I explained the changes to be made with the solution.

http://forum.planetchili.net/download/file.php?id=2296
PM me if you need to contact me. Thanks to all the helpful people on this forum especially to Chili.

egizz983
Posts: 311
Joined: August 27th, 2016, 12:30 pm

Re: C++ Winsock Networking Tutorials [11-16-2016]

Post by egizz983 » November 18th, 2016, 11:23 pm

Okay this is what i get with my current solution

Code: Select all

1>c:\users\winfows\desktop\game\engine\ChiliWin.h(24): warning C4005: '_WIN32_WINNT': macro redefinition (compiling source file Game.cpp)
1>  C:\Program Files (x86)\Windows Kits\8.1\Include\shared\sdkddkver.h(200): note: see previous definition of '_WIN32_WINNT' (compiling source file Game.cpp)
1>c:\users\winfows\desktop\game\engine\ChiliWin.h(63): warning C4005: 'STRICT': macro redefinition (compiling source file Game.cpp)
1>  C:\Program Files (x86)\Windows Kits\8.1\Include\shared\minwindef.h(23): note: see previous definition of 'STRICT' (compiling source file Game.cpp)
1>c:\users\winfows\desktop\game\engine\ChiliWin.h(24): warning C4005: '_WIN32_WINNT': macro redefinition (compiling source file MainWindow.cpp)
1>  C:\Program Files (x86)\Windows Kits\8.1\Include\shared\sdkddkver.h(200): note: see previous definition of '_WIN32_WINNT' (compiling source file MainWindow.cpp)
1>c:\users\winfows\desktop\game\engine\ChiliWin.h(63): warning C4005: 'STRICT': macro redefinition (compiling source file MainWindow.cpp)
1>  C:\Program Files (x86)\Windows Kits\8.1\Include\shared\minwindef.h(23): note: see previous definition of 'STRICT' (compiling source file MainWindow.cpp)
1>c:\users\winfows\desktop\game\engine\ChiliWin.h(24): warning C4005: '_WIN32_WINNT': macro redefinition (compiling source file Main.cpp)
1>  C:\Program Files (x86)\Windows Kits\8.1\Include\shared\sdkddkver.h(200): note: see previous definition of '_WIN32_WINNT' (compiling source file Main.cpp)
1>c:\users\winfows\desktop\game\engine\ChiliWin.h(63): warning C4005: 'STRICT': macro redefinition (compiling source file Main.cpp)
1>  C:\Program Files (x86)\Windows Kits\8.1\Include\shared\minwindef.h(23): note: see previous definition of 'STRICT' (compiling source file Main.cpp)
and with solution i download from you i get same just couple more warnings

Pindrought
Posts: 432
Joined: September 26th, 2013, 4:57 pm
Location: Kentucky
Contact:

Re: C++ Winsock Networking Tutorials [11-16-2016]

Post by Pindrought » November 18th, 2016, 11:26 pm

I hadn't realized that those errors were not there before you added the Client.h.
I don't think it will matter, but you can always remove the redefinitions from ChiliWin.h if it becomes an issue or if you need to get rid of the warnings.
PM me if you need to contact me. Thanks to all the helpful people on this forum especially to Chili.

egizz983
Posts: 311
Joined: August 27th, 2016, 12:30 pm

Re: C++ Winsock Networking Tutorials [11-16-2016]

Post by egizz983 » November 18th, 2016, 11:39 pm

Another problem i cant make Client object , if i try to make him inside a GameState i get pretty much same as before mowing client.h to mainwindow , and if i try to make client inside game object i get gives me an error that i cannot create incomplete type object .

Pindrought
Posts: 432
Joined: September 26th, 2013, 4:57 pm
Location: Kentucky
Contact:

Re: C++ Winsock Networking Tutorials [11-16-2016]

Post by Pindrought » November 19th, 2016, 12:11 am

egizz983 wrote:Another problem i cant make Client object , if i try to make him inside a GameState i get pretty much same as before mowing client.h to mainwindow , and if i try to make client inside game object i get gives me an error that i cannot create incomplete type object .
Yeah sorry I am having issues figuring out the correct order to have all of the includes and have it work properly in this project. If anyone else sees an easy way around this please chime in.
PM me if you need to contact me. Thanks to all the helpful people on this forum especially to Chili.

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: C++ Winsock Networking Tutorials [11-16-2016]

Post by albinopapa » November 19th, 2016, 5:14 am

Here's a way to do it, though I'm not sure how else to do it.

ChiliWin.h

Code: Select all

// Ws2tcpip.h includes WinSock2.h and WinSock2.h includes Windows.h, so only have to include Ws2tcpip instead of the other two.
#include <Ws2tcpip.h>
The lib I loaded in Main.cpp, though I don't think it matters where you load it.

Client.h

Code: Select all

#ifndef _INC_WINDOWS
#include "ChiliWin.h"
#endif
This basically says if _INC_WINDOWS is not #defined, then include ChiliWin.h. If it's already defined then ChiliWin.h won't be reincluded.

I think that's all the changes I made.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: C++ Winsock Networking Tutorials [11-16-2016]

Post by albinopapa » November 19th, 2016, 5:15 am

Oh, I take that back, I had to add
#undef min
#undef max
in Graphics.cpp and MainWindow.cpp
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

Post Reply