RakNet tcpinterface problem

Started by
5 comments, last by RevPT 16 years, 2 months ago
Hi there. I've been trying to learn how to work with RakNet. I configured my compiler as a Source User. Upon compiling the Tutorial code sample 1, provided on RakNet tutorial's page, I got the following error: ...\raknet\tcpinterface.cpp(66) : error C3861: 'printf': identifier not found I don't really know why that happened, but i just gave a shot and placed a #include <stdio.h> at the tcpinterface.h and then worse errors came out. This might be noobish, but I really do want to move on. Thanks in advance. Regards.
Advertisement
Are you using Visual C++ Express Edition 2005 and have not installed the platform SDK?
I'm using Visual Studio 2008 professional x64. It is packed with MS Windows SDK v6.0A.
First, make sure that <winsock2.h> always is included before <windows.h>.
Second, if you want to add a header, add it to the .cpp file that needs it, not another header.
Third, this really isn't a networking problem, but a visual studio support problem. Try the "general programming" forum, and if you don't get help there, try MSDN.
enum Bool { True, False, FileNotFound };
I haven't made a single line of code on this project. I used the tutorial sample, which doesn't include any of winshock2.h nor windows.h. These headers are used in the RakNets code, but I think they implemented it correctly. I don't really understand this problem as I used printf before with VS2008.

Anyway, the code compiled correctly by adding the stdio header to tcpinterface.cpp. Is this normal?

Thanks.
Hi,

Don't mean to be rude, but wouln't it be better if you posted your problem raknet problems on:
http://www.jenkinssoftware.com/raknet/forum/

The people who use raknet every day wil know very well how to solve wathever problem you are having with raknet. And if this really is some problem in the latest version they are likely to be very happy to fix it for everybody.

Other as that I find it very strange that you have such a problem because it compiles out of the box here. Exactly what tutorial are you trying to compile ?
The includes in front of the main file should be something like :

#include "RakPeerInterface.h"#include "RakNetworkFactory.h"#include "BitStream.h"#include <stdlib.h> // For atoi#include <cstring> // For strlen#include "Rand.h"#include "RakNetStatistics.h"#include "MessageIdentifiers.h"#include <stdio.h>#include "GetTime.h"#ifdef _WIN32#include <windows.h> // Sleep#else#include <unistd.h> // usleep#include <cstdio>#endif


You shouln't have to modify any of the library cpp or h files.

Cheers
Ponl
I've been trying to compile this one:
#include <stdio.h>#include "RakNetworkFactory.h"#include "RakPeerInterface.h"#define MAX_CLIENTS 10#define SERVER_PORT 60000int main(void){	char str[512];	RakPeerInterface *peer = RakNetworkFactory::GetRakPeerInterface();	bool isServer;		printf("(C) or (S)erver?\n");	gets(str);	if ((str[0]=='c')||(str[0]=='C'))	{		peer->Startup(1,30,&SocketDescriptor(), 1);		isServer = false;	} else {		peer->Startup(MAX_CLIENTS, 30, &SocketDescriptor(SERVER_PORT,0), 1);		isServer = true;	}	// TODO - Add code body here		RakNetworkFactory::DestroyRakPeerInterface(peer);	return 0;}

Anyway, I'll ask for help on RakNet's forum.

Thanks.

This topic is closed to new replies.

Advertisement