Erro ao compilar: error LNK2001: unresolved external symbol

0 respostas
G

Boa tarde, estou com um problema ao tentar compilar em C++
Talves seja fácil de se resolver, mas sou iniciante.

Erro

core.obj : error LNK2001: unresolved external symbol _harmony_core_init
core.obj : error LNK2001: unresolved external symbol _harmony_core_final

core.c - parte do arquivo onde entra o código

<blockquote>timer_init();

socket_init();

plugins_init();
[u]harmony_core_init();[/u]

do_init(argc,argv);	// Inicializa as funções do servidor
plugin_event_trigger(EVENT_ATHENA_INIT); // Evento inicial dos plugins

{// Ciclo principal do servidor
	int next;
	// Enquanto a runflag for verdadeira (1) o servidor rodará, do contrário entrará em processo de finalização
	while (runflag) {
		next = do_timer(gettick_nocache());
		do_sockets(next);
	}
}

[u]harmony_core_final();[/u]</blockquote>

harmony.h

#ifndef _HARMONYCORE_H
#define _HARMONYCORE_H

#include “…/common/harmserv.h”

void harmony_core_init();
void harmony_core_final();

harmonycore.c

#include “…/common/harmony.h”

void harmony_core_final() {

db_destroy(mod_exports);

db_destroy(harm_timer);

harm_funcs->final();

}
void harmony_core_init() {

int *module_version;

void (*module_init)();
if (!harmony_load_module(HARMCODEFILE)) {
	ShowFatalError("Unable to load Harmony module.\n");
	exit(EXIT_FAILURE);
}

module_version = (int*)harmony_get_symbol("version");
if (!module_version) {
	ShowFatalError("Unable to determine Harmony version.\n");
	exit(EXIT_FAILURE);
}

if (*module_version != HARMSRV_VERSION) {
	ShowFatalError("Invalid Harmony version! Expecting %d, have %d.\n", HARMSRV_VERSION, *module_version);
	ShowFatalError("Did you forget to recompile after updating?\n");
	exit(EXIT_FAILURE);
}
ShowStatus("Harmony Version: %d.%d.%d\n", HARMSRV_VERSION_MAJOR, HARMSRV_VERSION_MINOR, HARMSRV_VERSION_PATCH);

harm_funcs = (struct HARMSRV_HARM_FUNCS*)harmony_get_symbol("harm_funcs");
ea_funcs = (struct HARMSRV_EA_FUNCS*)harmony_get_symbol("ea_funcs");
module_init = (void(*)())harmony_get_symbol("Init");
if (!harm_funcs || !ea_funcs || !module_init) {
	ShowFatalError("Invalid harmony module exports.\n");
	exit(EXIT_FAILURE);
}

ea_funcs->alloc = crt_alloc;
ea_funcs->free = crt_free;
ea_funcs->exit = crt_exit;
ea_funcs->fopen = crt_fopen;
ea_funcs->fclose = crt_fclose;
ea_funcs->fread = crt_fread;
ea_funcs->fgets = crt_fgets;
<a class="hashtag" href="//www.guj.com.br/tags/if">#if</a> HARMSRV_VERSION >= 30312

ea_funcs->time = crt_time;

ea_funcs->rand = crt_rand;

ea_funcs->srand = crt_srand;

#endif
ea_funcs->harm_msg = harm_msg;
ea_funcs->harmsrv_abnormal_error = harmony_abnormal_start;
ea_funcs->ea_fd2harmsession = ea_fd2harmsession;
ea_funcs->ea_tick = ea_tick;
ea_funcs->timer_add = ea_timer_add;
ea_funcs->timer_del = ea_timer_del;
ea_funcs->socket_disconnect = ea_socket_disconnect;
ea_funcs->socket_send = ea_socket_send;

harm_timer = idb_alloc(DB_OPT_BASE);

module_init();
harm_funcs->init();

}

Aguardo uma resposta.
Desde já agradeço a ajuda.

Criado 3 de setembro de 2014
Respostas 0
Participantes 1