Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Problems with compiling  (Read 1807 times)

0 Members and 1 Guest are viewing this topic.

Hundrea

  • Newbie
  • *
  • Posts: 15
    • View Profile
Problems with compiling
« on: October 09, 2013, 01:44:16 am »
I have a problem when compiling.Keep getting these errors.http://prntscr.com/1w4zts
Heres the code
#include <iostream>
#include <SFML/Network.hpp>
using namespace std;


class NewBot{
sf::TcpSocket socket;
int ChatID;
public:
bool Connect(string ip,int port);
bool sendPackets(char data[100]);
string recievePackets();
NewBot(int k,int id);
};

NewBot::NewBot(int k,int id){
string ip="151.5151.15151.5418541";
int port=10014;
if(this->Connect(ip,port)){
    cout <<"Test1";
    //Room Number here
    char sendthingy[100]="<y r=\"15\" m=\"1\" />";
    this->sendPackets(sendthingy);
    cout << this->recievePackets();
}
}

bool NewBot::Connect(string ip,int port){
    sf::Socket::Status status=socket.connect(ip,port);
    bool returnvalue;
    if(status!=sf::Socket::Done){
        returnvalue=false;
    }
    else{
        returnvalue=true;
    }
    return returnvalue;
}

bool NewBot::sendPackets(char data[100]){
if(socket.send(data,100)!=sf::Socket::Done){
    cout<<"Error Could not send Packets";
    return false;
}
else{
    return true;
}
}

string NewBot::recievePackets(){
char data[100];
std::size_t received;
socket.receive(data, 100, received);
return data;
}


int main(){
int k,id; cin>>k; cin>>id;
NewBot Bot(k,id);
}
 
I compiled it with sfml 2.1
« Last Edit: October 09, 2013, 01:50:54 am by Hundrea »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Problems with compiling
« Reply #1 on: October 09, 2013, 08:03:05 am »
You must link to sfml-network.
Laurent Gomila - SFML developer

Hundrea

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Problems with compiling
« Reply #2 on: October 10, 2013, 12:08:43 am »
http://prntscr.com/1wbp5g
I still get a error though. Every time I click compile I just get this. http://prntscr.com/1wbpbt
http://prntscr.com/1wbqmm http://prntscr.com/1wbrkj
« Last Edit: October 10, 2013, 12:18:25 am by Hundrea »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Problems with compiling
« Reply #3 on: October 10, 2013, 07:40:28 am »
Learn how to use your debugger. Forums will not solve every single crash you'll face in your life ;)
Laurent Gomila - SFML developer

Hundrea

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Problems with compiling
« Reply #4 on: October 10, 2013, 04:29:48 pm »
i got it working in codeblocks  ;D