Однако при компиляции у меня вылазит куча ворнингов.
Помогите пожалуйста понять где ошибка. Есть 2 варианта:
1) Я криво компилю (я ведь новичек)
2) В гайде написано, что код для винды, а компилю я под линуксом.
- Код: Выделить всё
In file included from ./include/metamod/sdk_util.h:55:0,
from ./include/metamod/dllapi.h:40,
from ./include/metamod/meta_api.h:40,
from src/main.cpp:2:
./include/dlls/util.h:249:70: warning: ‘typedef’ was ignored in this declaration
typedef enum { point_hull=0, human_hull=1, large_hull=2, head_hull=3 };
^
In file included from ./include/metamod/dllapi.h:41:0,
from ./include/metamod/meta_api.h:40,
from src/main.cpp:2:
./include/metamod/osdep.h: In function ‘char* DLERROR()’:
./include/metamod/osdep.h:141:28: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
return("Invalid handle.");
^
In file included from ./include/metamod/dllapi.h:41:0,
from ./include/metamod/meta_api.h:40,
from src/main.cpp:2:
./include/metamod/osdep.h: In function ‘int THREAD_CREATE(THREAD_T*, void (*)())’:
./include/metamod/osdep.h:297:59: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
META_ERROR("Failure starting thread: %s", strerror(ret));
^
./include/metamod/osdep.h:302:60: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
META_ERROR("Failure detaching thread: %s", strerror(ret));
^
./include/metamod/osdep.h: In function ‘int MUTEX_INIT(MUTEX_T*)’:
./include/metamod/osdep.h:329:53: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
META_ERROR("mutex_init failed: %s", strerror(ret));
^
./include/metamod/osdep.h: In function ‘int MUTEX_LOCK(MUTEX_T*)’:
./include/metamod/osdep.h:336:53: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
META_ERROR("mutex_lock failed: %s", strerror(ret));
^
./include/metamod/osdep.h: In function ‘int MUTEX_UNLOCK(MUTEX_T*)’:
./include/metamod/osdep.h:343:55: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
META_ERROR("mutex_unlock failed: %s", strerror(ret));
^
./include/metamod/osdep.h: In function ‘int COND_INIT(COND_T*)’:
./include/metamod/osdep.h:374:52: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
META_ERROR("cond_init failed: %s", strerror(ret));
^
./include/metamod/osdep.h: In function ‘int COND_WAIT(COND_T*, MUTEX_T*)’:
./include/metamod/osdep.h:381:52: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
META_ERROR("cond_wait failed: %s", strerror(ret));
^
./include/metamod/osdep.h: In function ‘int COND_SIGNAL(COND_T*)’:
./include/metamod/osdep.h:388:54: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
META_ERROR("cond_signal failed: %s", strerror(ret));
^
src/main.cpp: At global scope:
src/main.cpp:14:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
};
^
src/main.cpp:14:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
src/main.cpp:14:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
src/main.cpp:14:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
src/main.cpp:14:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
src/main.cpp:14:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
src/main.cpp:14:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
src/main.cpp: In function ‘int Meta_Query(char*, plugin_info_t**, mutil_funcs_t*)’:
src/main.cpp:26:50: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
ALERT(at_console, "[HELLOWORLD]: meta_query\n");
^
src/main.cpp: In function ‘int Meta_Attach(PLUG_LOADTIME, META_FUNCTIONS*, meta_globals_t*, gamedll_funcs_t*)’:
src/main.cpp:32:51: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
ALERT(at_console, "[HELLOWORLD]: meta_attach\n");
^
src/main.cpp: In function ‘int Meta_Detach(PLUG_LOADTIME, PL_UNLOAD_REASON)’:
src/main.cpp:38:51: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
ALERT(at_console, "[HELLOWORLD]: meta_detach\n");
- Код: Выделить всё
COMPILER=g++
STANDART=c++11
INCLUDE=\
-I./include\
-I./include/common\
-I./include/dlls\
-I./include/engine\
-I./include/pm_shared\
-I./include/metamod
SOURCES=\
src/main.cpp
all:
$(COMPILER) $(SOURCES) -o metamod_helloworld.so -fPIC -shared $(INCLUDE)
- Код: Выделить всё
#include <extdll.h>
#include <meta_api.h>
plugin_info_t info = {
META_INTERFACE_VERSION, // ifvers
"HELLO WORLD", // name
"1.01", // version
"2011/01/15", // date
"--===((((][@KIRjkeeee))))===--", // author
"http://ultra.ucoz.ru", // url
"HELLOWORLD", // logtag, all caps please
PT_ANYTIME, // (when) loadable
PT_ANYPAUSE // (when) unloadable
};
enginefuncs_t g_engfuncs;
void WINAPI GiveFnptrsToDll(enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals)
{
memcpy(&g_engfuncs, pengfuncsFromEngine, sizeof(enginefuncs_t));
}
C_DLLEXPORT int Meta_Query(char *interfaceVersion, plugin_info_t **pinfo, mutil_funcs_t *pMetaUtilFuncs)
{
*pinfo = &info;
ALERT(at_console, "[HELLOWORLD]: meta_query\n");
return(TRUE);
}
C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, meta_globals_t *pMGlobals, gamedll_funcs_t *pGamedllFuncs)
{
ALERT(at_console, "[HELLOWORLD]: meta_attach\n");
return(TRUE);
}
C_DLLEXPORT int Meta_Detach(PLUG_LOADTIME now, PL_UNLOAD_REASON reason)
{
ALERT(at_console, "[HELLOWORLD]: meta_detach\n");
return(TRUE);
}
Ну а если подключить скомпиленую либу к метамоду, то во первых: никакого хеллоуворда не выведется, а во вторых при перезагрузке сервера будет Вы должны зарегистрироваться, чтобы видеть ссылки.
Возжно кто-то знает как запилить что бы все работало? Ну или гайдец для линукса. Пусть даже на енглише, буду с гуглопереводчиком пытаться перевести.
Название темы скорректировано // liFe iS GoOD