you must include ws2_32.lib. Google how to do it in dev c++ cuz i am not familiar with it.
whenever i try to compile my program i get "TcpClient undeclared". How do i fix this?
dev c++ portable
empty project
you must include ws2_32.lib. Google how to do it in dev c++ cuz i am not familiar with it.
KissU (09-27-2011)
Just yesterday I made a chat client for my cousin's project.
[highlight=c++]#pragma comment(lib, "ws2_32.lib")
#include <winsock2.h>[/highlight]
First line clears up some unresolved symbols.
As far as I know, #pragma comment is specifically supported by VC++. DevC++ uses MingW. To include library in DevC++, goto Project Options and then on Parameters Tab.
The preprocessors are likley the same for dev and vs
I tried including common sockrt headers to no succss. I shouldnt have to though, tcpclient is supposedly in the standard library.
EDIT: heres a snippet of the code[
Code:/* INCLUDES */ #pragma comment(lib, "ws2_32.lib") #include <winsock2.h> #include <windows.h> #include <iostream> /* NAMESPACES */ using namespace std; /* FUNCTION PROTOTYPES */ void print(const char [32]); int main() { char buf[50]; char username[16]; char password[32]; print("welcome to mc_bot 1.0!"); printf("username: "); scanf("%s", username); printf("password: "); scanf("%s", password); TcpClient client = new TcpClient("127.0.0.1", 26656); Sleep(2000); return 0; }
Last edited by kibbles18; 09-24-2011 at 10:49 AM.
thanks for the bump