• Advertisement
Sign in to follow this  

Networking questions.

This topic is 4169 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am just crossing the border to Networking. I am trying to make a small two player game. I am using the allegro library also which doesn’t have network support. I am trying to learn Winsock2. I have the platform SDK and linked everything. but I do get errors when i was looking at MSDN "creating a simple Winsock application" and I call struct addrinfo *result = NULL, *ptr = NULL, hints; Aggregate 'addrinfo hints has incomplete type and cannot be defined'. Also I am using the dev-cpp compiler I do not know if this causes problems. I have heard that it is a bad compiler and some say it is good. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/initializing_winsock.asp //This is the link to the MSDN tutorial /*btw I do not know how to turn the code posted into the code viewer so if itz some HTML tag please tell me! */

Share this post


Link to post
Share on other sites
Advertisement
The error means that the compiler cannot find the struct called "addrinfo", so it cannnot allocate space for it ( it doesnt know what size it is ). You can have pointers to incomplete types, but you cannot allocate them until they are defined. You need to add a * before hints, or include a header that completes the addrinfo struct ( I dont know if you can, I dont use winsock ).

Dev-Cpp is an IDE, not a compiler. The compiler it uses, gcc, is a perfectly good compiler. You may find that it is easier to use internet examples if you use msvc++, there is a free version somewhere I believe, as many internet examples use msvc extensions. The msvc IDE is supposably very good too.

To post code, for small snippets you can use [ code ] and [ /code ], which preserve indentation, or you can use [ source ] [ /source ] to get syntax highlighting and a scrollable box. Neither tag contains spaces.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement