• 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!

Compiling Avesta 7.6 Compiling ERRORS HElp me please!

destroyer667

Member
Joined
Nov 21, 2007
Messages
290
Reaction score
6
Here are my errors.


and my linkers


-D__USE_MYSQL__
-D__USE_SQLITE__
-D__SKULLSYSTEM__
-D__USE_OTPCH__
-D__ENABLE_SERVER_DIAGNOSTIC__

-D__PB_GMINVISIBLE__
-D__XID_EXPERIENCE_STAGES__


-llibxml2
-lwsock32
-lsqlite3
-lmysql
-lws2_32
-llua5.1
-lboost_date_time
-lboost_system
-lboost_thread
-lboost_regex
-lboost_filesystem
-lgmp
-s

5lykwx.jpg
 
how do i do that? im very new to compiling i just started yesterday and looked at many tutorials. i found this folder in my Dev-cpp folder "boost_1_31_0"
 
This errors happens because you don't have some library like "Boost" and "Lua" library.

To instal, follow this.

- At DEV C++, click on Help\About Dev-C++, at windows of "About" click at Check for Updates.
- Select DevPack Server: "devpaks.org" then click check for updates
- Then select the letest LUA and BOOST library at Available update list and click "download selected"

That should solve your problem

:D
 
Am i using the right linkers and compilers? As i posted above.

im using Avesta 7.6 im not sure if im using all the correct linkers n stuff. im new to this trying to seek help. i looked at tutorials but none are for avesta 7.6

Also i'd liek to point out the avesta source didn't come with a .dev file so i tried to make my own maybe i messed it up.


I used this tutorial and it didn't help.

http://otfans.net/threads/36385-Compiling-How-to-compile-Otserv-100-!!

these are my new errors.


2w4cxa0.jpg
 
Last edited:
Come onnnnnnnnnn i know there are ppl who know a crap load about this just tell me whats wrong so i can try and fix it!!!!!!! all i need to do is compile this stupid ass server and i can release it... im only waiting on this :/
 
kk i did what you said and added in the iconv.h to ym dev-cpp folder. and fixed a bunch of other stuff now im at a point where i dont understand why its not working. I read the errors but these ones idk how to fix.

Scheduler.cpp
PHP:
//////////////////////////////////////////////////////////////////////
// OpenTibia - an opensource roleplaying game
//////////////////////////////////////////////////////////////////////
// Scheduler-Objects for OpenTibia
//////////////////////////////////////////////////////////////////////
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//////////////////////////////////////////////////////////////////////
#include "otpch.h"

#include "scheduler.h"
#include <iostream>

#if defined __EXCEPTION_TRACER__
#include "exception.h"
#endif

Scheduler::SchedulerState Scheduler::m_threadState = Scheduler::STATE_TERMINATED;

Scheduler::Scheduler()
{
	m_lastEventId = 0;
	Scheduler::m_threadState = STATE_RUNNING;
	boost::thread(boost::bind(&Scheduler::schedulerThread, (void*)NULL));
}

void Scheduler::schedulerThread(void* p)
{
	#if defined __EXCEPTION_TRACER__
	ExceptionHandler schedulerExceptionHandler;
	schedulerExceptionHandler.InstallHandler();
	#endif
	srand((unsigned int)OTSYS_TIME());
	#ifdef __DEBUG_SCHEDULER__
	std::cout << "Starting Scheduler" << std::endl;
	#endif

	// NOTE: second argument defer_lock is to prevent from immediate locking
	boost::unique_lock<boost::mutex> eventLockUnique(getScheduler().m_eventLock, boost::defer_lock);

	while(Scheduler::m_threadState != Scheduler::STATE_TERMINATED){
		SchedulerTask* task = NULL;
		bool runTask = false;
		bool ret = true;

		// check if there are events waiting...
		eventLockUnique.lock();

		if(getScheduler().m_eventList.empty()){
			#ifdef __DEBUG_SCHEDULER__
			std::cout << "Scheduler: No events" << std::endl;
			#endif
			getScheduler().m_eventSignal.wait(eventLockUnique);
		}
		else{
			#ifdef __DEBUG_SCHEDULER__
			std::cout << "Scheduler: Waiting for event" << std::endl;
			#endif
			ret = getScheduler().m_eventSignal.timed_wait(eventLockUnique, getScheduler().m_eventList.top()->getCycle());
		}

		#ifdef __DEBUG_SCHEDULER__
		std::cout << "Scheduler: Signaled" << std::endl;
		#endif

		// the mutex is locked again now...
		if(ret == false && (Scheduler::m_threadState != Scheduler::STATE_TERMINATED)){
			// ok we had a timeout, so there has to be an event we have to execute...
			task = getScheduler().m_eventList.top();
			getScheduler().m_eventList.pop();

			// check if the event was stopped
			EventIdSet::iterator it = getScheduler().m_eventIds.find(task->getEventId());
			if(it != getScheduler().m_eventIds.end()){
				// was not stopped so we should run it
				runTask = true;
				getScheduler().m_eventIds.erase(it);
			}
		}
		eventLockUnique.unlock();

		// add task to dispatcher
		if(task){
			// if it was not stopped
			if(runTask){
				#ifdef __DEBUG_SCHEDULER__
				std::cout << "Scheduler: Executing event " << task->getEventId() << std::endl;
				#endif
				Dispatcher::getDispatcher().addTask(task);
			}
			else{
				// was stopped, have to be deleted here
				delete task;
			}
		}
	}
#if defined __EXCEPTION_TRACER__
	schedulerExceptionHandler.RemoveHandler();
#endif
}

uint32_t Scheduler::addEvent(SchedulerTask* task)
{
	bool do_signal = false;
	m_eventLock.lock();
	if(Scheduler::m_threadState == Scheduler::STATE_RUNNING){
		// check if the event has a valid id
		if(task->getEventId() == 0){
			// if not generate one
			if(m_lastEventId >= 0xFFFFFFFF){
				m_lastEventId = 0;
			}
			++m_lastEventId;
			task->setEventId(m_lastEventId);
		}
		// insert the eventid in the list of active events
		m_eventIds.insert(task->getEventId());

		// add the event to the queue
		m_eventList.push(task);

		// if the list was empty or this event is the top in the list
		// we have to signal it
		do_signal = (task == m_eventList.top());

		#ifdef __DEBUG_SCHEDULER__
		std::cout << "Scheduler: Added event " << task->getEventId() << std::endl;
		#endif
	}
#ifdef __DEBUG_SCHEDULER__
	else{
		std::cout << "Error: [Scheduler::addTask] Scheduler thread is terminated." << std::endl;
	}
#endif

	m_eventLock.unlock();

	if(do_signal){
		m_eventSignal.notify_one();
	}

	return task->getEventId();
}

bool Scheduler::stopEvent(uint32_t eventid)
{
	if(eventid == 0)
		return false;

	#ifdef __DEBUG_SCHEDULER__
	std::cout << "Scheduler: Stopping event " << eventid << std::endl;
	#endif

	m_eventLock.lock();

	// search the event id..
	EventIdSet::iterator it = m_eventIds.find(eventid);
	if(it != m_eventIds.end()) {
		// if it is found erase from the list
		m_eventIds.erase(it);
		m_eventLock.unlock();
		return true;
	}
	else{
		// this eventid is not valid
		m_eventLock.unlock();
		return false;
	}
}

void Scheduler::stop()
{
	#ifdef __DEBUG_SCHEDULER__
	std::cout << "Stopping Scheduler" << std::endl;
	#endif
	m_eventLock.lock();
	m_threadState = Scheduler::STATE_CLOSING;
	m_eventLock.unlock();
}

void Scheduler::shutdown()
{
	#ifdef __DEBUG_SCHEDULER__
	std::cout << "Shutdown Scheduler" << std::endl;
	#endif
	m_eventLock.lock();
	m_threadState = Scheduler::STATE_TERMINATED;

	//this list should already be empty
	while(!m_eventList.empty()){
		m_eventList.pop();
	}
	m_eventIds.clear();
	m_eventLock.unlock();
}


Scheduler.h
PHP:
//////////////////////////////////////////////////////////////////////
// OpenTibia - an opensource roleplaying game
//////////////////////////////////////////////////////////////////////
// Scheduler-Objects for OpenTibia
//////////////////////////////////////////////////////////////////////
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//////////////////////////////////////////////////////////////////////

#ifndef __OTSERV_SCHEDULER_H__
#define __OTSERV_SCHEDULER_H__

#include <boost/bind.hpp>
#include <vector>
#include <queue>
#include <set>

#include "tasks.h"
#include "otsystem.h"

#define SCHEDULER_MINTICKS 50

class SchedulerTask : public Task
{
public:
	~SchedulerTask() {}
		
	void setEventId(uint32_t eventid) {m_eventid = eventid;}
	uint32_t getEventId() const {return m_eventid;}
	
	boost::system_time; getCycle() const {return m_cycle;}
	
	;bool operator<(const SchedulerTask& other) const
	{
		return getCycle() > other.getCycle();
	}
	
protected:
	
	SchedulerTask(uint32_t delay, boost::function<void (void)> f) : Task(f) {
		;m_cycle = boost::get_system_time() + boost::posix_time::milliseconds(delay);
		m_eventid = 0;
	}
	
	boost::system_time m_cycle;
	uint32_t m_eventid;
	
	friend SchedulerTask* createSchedulerTask(uint32_t, boost::function<void (void)>);
};

inline SchedulerTask* createSchedulerTask(uint32_t delay, boost::function<void (void)> f)
{
    assert(delay != 0);
    if(delay < SCHEDULER_MINTICKS){
        delay = SCHEDULER_MINTICKS;
    }
	return new SchedulerTask(delay, f);
}

class lessSchedTask : public std::binary_function<SchedulerTask*&, SchedulerTask*&, bool>
{
public:
	bool operator()(SchedulerTask*& t1, SchedulerTask*& t2)
	{
		return (*t1) < (*t2);
	}
};

class Scheduler
{
public:
	~Scheduler() {}
	
	static Scheduler& getScheduler()
	{
		static Scheduler scheduler;
		return scheduler;
	}
	
	uint32_t addEvent(SchedulerTask* task);
	bool stopEvent(uint32_t eventId);
	void stop();
	void shutdown();
	
	static void schedulerThread(void* p);

	enum SchedulerState{
		STATE_RUNNING,
		STATE_CLOSING,
		STATE_TERMINATED,
	};
	
protected:
	Scheduler();

	boost::mutex m_eventLock;
	boost::condition_variable; m_eventSignal;

	uint32_t m_lastEventId;
	std::priority_queue<SchedulerTask*, std::vector<SchedulerTask*>, lessSchedTask > m_eventList;
	typedef std::set<uint32_t> EventIdSet;
	EventIdSet m_eventIds;
	static SchedulerState m_threadState;
};


#endif



107rgis.jpg
 
Last edited:

Similar threads

Back
Top