• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Linux Compiling

RogerGalvao

New Member
Joined
Nov 23, 2012
Messages
6
Reaction score
0
I try compilling in Ubuntu 12.04 LTS this source , http://otland.net/f18/8-60-lost-server-0-3-6-a-161517/ it give a error

F .deps/otserv.Tpo -c -o otserv.o otserv.cpp
In file included from game.h:22:0,
from otserv.cpp:34:
enums.h: No construtor ‘Outfit_t::Outfit_t(uint16_t)’:
enums.h:292:13: aviso: statement has no effect [-Wunused-value]
otserv.cpp: Na função ‘void signalHandler(int32_t)’:
otserv.cpp:179:8: erro: ‘SIGHUP’ was not declared in this scope
otserv.cpp:184:8: erro: ‘SIGTRAP’ was not declared in this scope
otserv.cpp:188:8: erro: ‘SIGCHLD’ was not declared in this scope
otserv.cpp:192:8: erro: ‘SIGUSR1’ was not declared in this scope
otserv.cpp:197:8: erro: ‘SIGUSR2’ was not declared in this scope
otserv.cpp:201:8: erro: ‘SIGCONT’ was not declared in this scope
otserv.cpp:205:8: erro: ‘SIGQUIT’ was not declared in this scope
otserv.cpp:210:8: erro: ‘SIGTERM’ was not declared in this scope
otserv.cpp: Na função ‘int main(int, char**)’:
otserv.cpp:284:19: erro: aggregate ‘main(int, char**)::sigaction sigh’ has incomplete type and cannot be defined
otserv.cpp:285:20: erro: ‘SIG_IGN’ was not declared in this scope
otserv.cpp:287:27: erro: ‘sigemptyset’ was not declared in this scope
otserv.cpp:288:12: erro: ‘SIGPIPE’ was not declared in this scope
otserv.cpp:288:32: erro: invalid use of incomplete type ‘struct main(int, char**)::sigaction’
otserv.cpp:284:9: erro: forward declaration of ‘struct main(int, char**)::sigaction’
otserv.cpp:291:9: erro: ‘SIGHUP’ was not declared in this scope
otserv.cpp:291:30: erro: ‘signal’ was not declared in this scope
otserv.cpp:292:9: erro: ‘SIGTRAP’ was not declared in this scope
otserv.cpp:293:9: erro: ‘SIGCHLD’ was not declared in this scope
otserv.cpp:294:9: erro: ‘SIGUSR1’ was not declared in this scope
otserv.cpp:295:9: erro: ‘SIGUSR2’ was not declared in this scope
otserv.cpp:296:9: erro: ‘SIGCONT’ was not declared in this scope
otserv.cpp:297:9: erro: ‘SIGQUIT’ was not declared in this scope
otserv.cpp:298:9: erro: ‘SIGTERM’ was not declared in this scope
otserv.cpp: Na função ‘void allocationHandler()’:
otserv.cpp:231:28: aviso: ignoring return value of ‘char* fgets(char*, int, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
make[1]: ** [otserv.o] Erro 1
make[1]: Saindo do diretório `/home/rogerio/Downloads/source'
make: ** [all] Erro 2
 
I tried and did not work, I could not find it in the file

std::string getGlobalIP()
{
WSADATA wsaData;

if(WSAStartup(MAKEWORD(2, 0), &wsaData) != 0)
return "Not found";

SOCKET s = socket(AF_INET, SOCK_STREAM, 0);
HOSTENT *host;
host = gethostbyname("www.whatismyip.com");
SOCKADDR_IN sin;
memset(&sin, 0, sizeof sin);

sin.sin_family = AF_INET;
sin.sin_addr.s_addr = ((struct in_addr*)(host->h_addr))->s_addr;
sin.sin_port = htons(80);

if(connect(s, (struct sockaddr*)&sin, sizeof(sin)) != SOCKET_ERROR){
//std::cout << "Connected" << std::endl;
std::string request = "GET Automation Rules | What Is My IP Address HTTP/1.1\r\nHost: www.whatismyip.com\r\n\r\n";
if(send(s, request.c_str(), request.length(), 0) != request.length())
std::cout << "Error sending request: " << WSAGetLastError() << std::endl;

char buffer[2048];
std::string response;
recv(s, (char*)&buffer, 2048, 0);
response = std::string(buffer);
int start = int(response.find("\r\n\r\n"));
int iplength = response.length()-start;

std::string ip = "";
for(int i = start; i < response.length(); i++){
if((response.at(i) >= '0' && response.at(i) <= '9') || response.at(i) == '.') ip += response.at(i);
}

closesocket(s);

return ip;
}
else{
std::cout << "Could not connect: " << WSAGetLastError() << std::endl;
}

return "127.0.0.1";
}

In otserv.cpp
 
Back
Top