SampGDK link troubles.(MSVC and Code::Blocks)
#1

Hello all. Sorry for my bad english. But i'll try to speak it.

Today i was starting development my gamemode on sampgdk. My OS is Windows. I tried to build my project in two IDEs: Visual Studio and Code::blocks. I added sampgdk_s.lib into additional dependencies. Tried to link and got this errors:
Код:
1>main.obj : error LNK2019: ссылка на неразрешенный внешний символ __imp__sampgdk_init_plugin в функции "public: int __thiscall Plugin::Load(void * *)" (?Load@Plugin@@QAEHPAPAX@Z)
1>main.obj : error LNK2019: ссылка на неразрешенный внешний символ __imp__sampgdk_cleanup_plugin в функции "public: int __thiscall Plugin::Unload(void)" (?Unload@Plugin@@QAEHXZ)
1>main.obj : error LNK2019: ссылка на неразрешенный внешний символ __imp__sampgdk_process_plugin_timers в функции "public: void __thiscall Plugin::ProcessTimers(void)" (?ProcessTimers@Plugin@@QAEXXZ)
1>main.obj : error LNK2019: ссылка на неразрешенный внешний символ __imp__sampgdk_get_plugin_handle в функции "public: __thiscall ThisPlugin::ThisPlugin(void)" (??0ThisPlugin@@QAE@XZ)
1>HMPlayer.obj : error LNK2019: ссылка на неразрешенный внешний символ __imp__sampgdk_ShowPlayerDialog в функции "bool __cdecl ShowPlayerDialog(int,int,int,char const *,char const *,char const *,char const *)" (?ShowPlayerDialog@@YA_NHHHPBD000@Z)
1>C:\Users\Bupyc\Desktop\ModC++\Debug\TesT.dll : fatal error LNK1120: 5 неразрешенных внешних элементов
In code::blocks i added library to linker options like on linux and got same errors.

Please, help me.
I'm sure that trouble in library because on linux i have no any problems. Thanks for reading.
Reply
#2

You have to define SAMPGDK_STATIC when linking against the static library (this isn't documented anywhere though, sorry for that).
Reply
#3

Quote:
Originally Posted by xeeZ
Посмотреть сообщение
You have to define SAMPGDK_STATIC when linking against the static library (this isn't documented anywhere though, sorry for that).
I added #define SAMPGDK_STATIC into my code and got this errors:
Код:
Warning: .drectve `/DEFAULTLIB:"msvcprt" /DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
Warning: .drectve `/DEFAULTLIB:"msvcprt" /DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
....
Cannot export ??_C@_00CNPNBAHC@?$AA@: symbol not found
Cannot export ??_C@_01EEMJAFIK@?6?$AA@: symbol not found
Cannot export ??_C@_02DKCKIIND@?$CFs?$AA@: symbol not found
Cannot export ??_C@_03FNMNFHGL@Ban?$AA@: symbol not found
Cannot export ??_C@_04IHFOKGLE@gpci?$AA@: symbol not found
Cannot export ??_C@_04JMEIBOCG@Kick?$AA@: symbol not found
Cannot export ??_C@_04MEDPFIKH@HTTP?$AA@: symbol not found
Cannot export ??_C@_05OCLBJHCD@BanEx?$AA@: symbol not found
Cannot export ??_C@_07DAHDDNBK@funcidx?$AA@: symbol not found
Cannot export ??_C@_07DEBODCIP@TRACE?3?5?$AA@: symbol not found
Cannot export ??_C@_07JHDPBCI@ERROR?3?5?$AA@: symbol not found
Cannot export ??_C@_09PIEMHOIP@WARNING?3?5?$AA@: symbol not found
Cannot export ??_C@_0BA@BEPEMNF@GetPlayerHealth?$AA@: symbol not found
.....
C:\Users\Bupyc\Desktop\ModC++\ModC++\sampgdk3_s.lib(sampgdk.dir/RelWithDebInfo/logprintf.obj):(.text[_sampgdk_do_vlogprintf]+0xa): undefined reference to `__security_cookie'
C:\Users\Bupyc\Desktop\ModC++\ModC++\sampgdk3_s.lib(sampgdk.dir/RelWithDebInfo/logprintf.obj):(.text[_sampgdk_do_vlogprintf]+0x29): undefined reference to `_imp__vsprintf_s'
C:\Users\Bupyc\Desktop\ModC++\ModC++\sampgdk3_s.lib(sampgdk.dir/RelWithDebInfo/logprintf.obj):(.text[_sampgdk_do_vlogprintf]+0x48): undefined reference to `@__security_check_cookie@4'
C:\Users\Bupyc\Desktop\ModC++\ModC++\sampgdk3_s.lib(sampgdk.dir/RelWithDebInfo/a_vehicles-impl.obj):(.text[_sampgdk_GetVehicleDistanceFromPoint]+0x7): undefined reference to `__security_cookie'
C:\Users\Bupyc\Desktop\ModC++\ModC++\sampgdk3_s.lib(sampgdk.dir/RelWithDebInfo/a_vehicles-impl.obj):(.text[_sampgdk_GetVehicleDistanceFromPoint]+0x69): undefined reference to `@__security_check_cookie@4'
C:\Users\Bupyc\Desktop\ModC++\ModC++\sampgdk3_s.lib(sampgdk.dir/RelWithDebInfo/a_vehicles-impl.obj):(.text[_sampgdk_CreateVehicle]+0x7): undefined reference to `__security_cookie'
C:\Users\Bupyc\Desktop\ModC++\ModC++\sampgdk3_s.lib(sampgdk.dir/RelWithDebInfo/a_vehicles-impl.obj):(.text[_sampgdk_CreateVehicle]+0x7b): undefined reference to `@__security_check_cookie@4'
C:\Users\Bupyc\Desktop\ModC++\ModC++\sampgdk3_s.lib(sampgdk.dir/RelWithDebInfo/a_vehicles-impl.obj):(.text[_sampgdk_IsVehicleStreamedIn]+0x7): undefined reference to `__security_cookie'
....
Reply
#4

I'm afraid you can't use the .lib with MinGW as it was compiled with MSVC 2010. You probably would be better off building sampgdk with MinGW and using that instead, or you could just stick with MSVC (AFAIK Code::Blocks works with Microsoft compilers too).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)