Sign in to follow this  

RakNet tcpinterface problem

This topic is 3598 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

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
I've been trying to compile this one:

#include <stdio.h>
#include "RakNetworkFactory.h"
#include "RakPeerInterface.h"

#define MAX_CLIENTS 10
#define SERVER_PORT 60000

int 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.

Share this post


Link to post
Share on other sites

This topic is 3598 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this