# Hello Network for DevC++

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

## Recommended Posts

I consider myself green when it comes to networks, I am a noob when it comes to writing networking apps. I've got DevC++ and "GameDev.net's how to write multiplayer games.", which is writen for Visual Studio's 6. The information is all good except for the VS6.0 specific code. I've looked for networking with DevC++ on this forum and can't find any thing. Where do I go to find networking code writing for games in DevC++? Thank you in advance, BladeStone

##### Share on other sites
there should be absolutely no difference between code written for visual studio and code that works in Dev-C++. Generally VS6.0 sucks chunks so you have to use some retarded (but valid) syntax to get things working; but it should play nice in DevC++

My guess is that you didn't set your project up correctly: you aren't #include'ing the correct files, or linking to the correct libraries.

-me

##### Share on other sites
I'm typing from work right now on lunch break (I'm an office manager by day, coder by night), therefore, I don't have the compiler comments infront of me. I was doing the ConnectText in Chapter 4 out of the GameDev.net networking book.

I replaced all the NULL with '\0' and that cleared up all the errors.

But the linker errors were all related to the ws2_32.lib file which was not any where to be found. I spent all night looking on the net for it, and the only place I could find the file it's self was in VS2005. I can't get the VS2005 freebie thing from MS because I don't have the right operating system so it refused to extract it's self.

##### Share on other sites
Home now, and here is what the linker has to say:

Compiler: Default compiler
Building Makefile: "C:\J2SDK\DevCPP\ConnectionDev\Makefile.win"
Executing make clean
rm -f DevConn01.o DevConnect01.exe

g++.exe -c DevConn01.cpp -o DevConn01.o -I"C:/J2SDK/DEVCPP/lib/gcc/mingw32/3.4.2/include" -I"C:/J2SDK/DEVCPP/include/c++/3.4.2/backward" -I"C:/J2SDK/DEVCPP/include/c++/3.4.2/mingw32" -I"C:/J2SDK/DEVCPP/include/c++/3.4.2" -I"C:/J2SDK/DEVCPP/include"

g++.exe DevConn01.o -o "DevConnect01.exe" -L"C:/J2SDK/DEVCPP/lib"

DevConn01.o(.text+0x134):DevConn01.cpp: undefined reference to WSAStartup@8'
DevConn01.o(.text+0x178):DevConn01.cpp: undefined reference to WSAStartup@8'
DevConn01.o(.text+0x37b):DevConn01.cpp: undefined reference to recv@16'
DevConn01.o(.text+0x495):DevConn01.cpp: undefined reference to send@16'
DevConn01.o(.text+0x4d1):DevConn01.cpp: undefined reference to inet_addr@4'
DevConn01.o(.text+0x4e8):DevConn01.cpp: undefined reference to gethostbyname@4'
DevConn01.o(.text+0x50f):DevConn01.cpp: undefined reference to WSASetLastError@4'
DevConn01.o(.text+0x52c):DevConn01.cpp: undefined reference to htons@4'
DevConn01.o(.text+0x552):DevConn01.cpp: undefined reference to socket@12'
DevConn01.o(.text+0x587):DevConn01.cpp: undefined reference to connect@12'
DevConn01.o(.text+0x647):DevConn01.cpp: undefined reference to closesocket@4'
DevConn01.o(.text+0x67c):DevConn01.cpp: undefined reference to socket@12'
DevConn01.o(.text+0x6c2):DevConn01.cpp: undefined reference to htonl@4'
DevConn01.o(.text+0x6d6):DevConn01.cpp: undefined reference to htons@4'
DevConn01.o(.text+0x6f9):DevConn01.cpp: undefined reference to bind@12'
DevConn01.o(.text+0x73f):DevConn01.cpp: undefined reference to listen@8'
DevConn01.o(.text+0x770):DevConn01.cpp: undefined reference to accept@12'
DevConn01.o(.text+0x87c):DevConn01.cpp: undefined reference to recv@16'
DevConn01.o(.text+0x8aa):DevConn01.cpp: undefined reference to send@16'
DevConn01.o(.text+0xaae):DevConn01.cpp: undefined reference to WSACleanup@0'
collect2: ld returned 1 exit status

Execution terminated

##### Share on other sites
Did you remember to link to ws2_32.lib?

Edit: just read your earlier post saying you couldn't find the lib. It should be included in the Platform SDK if you don't already have it.

[Edited by - Driv3MeFar on March 1, 2007 7:44:15 PM]

##### Share on other sites
I don't have that library, it's a library for VS6.0 which is needed for the sample code from chapter 4, first code example from "GameDev.net Multiplayer Game Programming" which is where the tutorial came from. I don't have VS6.0, I've got GameDevC++ and ws2_32.lib is no where in my system and I can't find it for download on the net.

I need to find DevC++ Network code samples. Or advice to replace that library with one I've got.

##### Share on other sites
Dev-C++ should provide its own version of the Winsock2 library called libws2_32.a. Try linking to that.

##### Share on other sites
OMG OMG OMG!
That works! thank you!!!