Fran here with a little problem.
Recently, I've been working on a chat project.
This project consists of two people chatting with eachother (Self-Explanitory).
I found this server code online, just as a startup sort of file to test my socket server.
#include <iostream>
#include "Included/winsock2.h"
int main() {
WSAData wsa;
WORD Version = MAKEWORD(2, 1);
WSAStartup(Version, &wsa);
SOCKET Listen = socket(AF_INET, SOCK_STREAM, NULL);
SOCKET Connect = socket(AF_INET, SOCK_STREAM, NULL);
SOCKADDR_IN Server;
Server.sin_addr.s_addr = inet_addr("127.0.0.1");
Server.sin_family = AF_INET;
Server.sin_port = htons(100);
bind(Listen, (SOCKADDR*)&Server, sizeof(server));
listen(Listen, 1);
int size = sizeof(Server);
std::cout<<"Listening...";
for(;;)/> {
if (Connect = accept(Listen, (SOCKADDR*)&Server, &size)) {
std::cout<<"\nConnection was reached";
break;
}
}
WSACleanup();
std::cin.get();
return 0;
}
I used this straight from a socket server tutorial (Via Youtube).
His worked perfectly fine! But mine, does not...
What am I doing wrong with this???
I'm getting this error (Won't even open):
In function 'console_main': [Linker error] undefined reference to 'SDL_main' Id returned 1 exit status [Build Error] [Server-TEST.exe] Error 1
Not sure what i'm doing wrong,
linws2_32.a is linked, as well.
I'm using Dev-C++ for this compilation.
(Also, Please don't tell me I should get a new compiler! I know Dev-C++ isn't a great source for compiling, but it's easiest for me).
Thanks guys,
Fran (Anonymous Idon User)
Typo!:
libws2_32.a is included.
Thanks again,
Fran (Anonymous Idon User)

New Topic/Question
Reply



MultiQuote





|