A few SDK issues... - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: A few SDK issues... (
/showthread.php?tid=437860)
A few SDK issues... -
Aeonosphere - 17.05.2013
C/C++ knowledge isn't really the issue, it's more of just a general SDK issue. Essentially, I've got some code going, that ideally I'd prefer to code in PAWN, but just isn't really possible. Anyways, regardless, I decided to just make a quick C++ plugin.
I then receive these error messages. I have tried usual routes of correcting such error messages, but I think perhaps something else is the matter that the compiler is not quite picking up on.
Errors:
Code:
1>main.obj : error LNK2019: unresolved external symbol _amx_GetString referenced in function "long __cdecl lastspace(struct tagAMX *,long *)" (?lastspace@@YAJPAUtagAMX@@PAJ@Z)
1>main.obj : error LNK2019: unresolved external symbol _amx_StrLen referenced in function "long __cdecl lastspace(struct tagAMX *,long *)" (?lastspace@@YAJPAUtagAMX@@PAJ@Z)
1>main.obj : error LNK2019: unresolved external symbol _amx_GetAddr referenced in function "long __cdecl lastspace(struct tagAMX *,long *)" (?lastspace@@YAJPAUtagAMX@@PAJ@Z)
1>main.obj : error LNK2019: unresolved external symbol _amx_Register referenced in function _AmxLoad@4
Code:
Code:
#include "SDK\amx\amx.h"
#include "SDK\plugincommon.h"
#include <string>
#include <cstdlib>
using namespace std;
typedef void (*logprintf_t) (char* format, ...);
logprintf_t logprintf;
extern void *pAMXFunctions;
PLUGIN_EXPORT unsigned int PLUGIN_CALL Supports()
{
return SUPPORTS_VERSION | SUPPORTS_AMX_NATIVES;
}
PLUGIN_EXPORT bool PLUGIN_CALL Load(void **ppData)
{
pAMXFunctions = ppData[PLUGIN_DATA_AMX_EXPORTS];
logprintf = (logprintf_t) ppData[PLUGIN_DATA_LOGPRINTF];
logprintf("[MULTILINE] Multiline (by Aeonosphere) was successfully loaded...");
return true;
}
PLUGIN_EXPORT void PLUGIN_CALL Unload()
{
logprintf("[MULTILINE] Multiline (by Aeonosphere) was successfully unloaded...");
}
//[START OF NATIVE FUNCTIONS]//
//PAWN native: native lastspace(const str[]);
cell AMX_NATIVE_CALL lastspace(AMX* amx, cell* str)
{
int len = NULL;
cell *addr = NULL;
amx_GetAddr(amx, str[1], &addr);
amx_StrLen(addr, &len);
if(len)
{
++len;
char* celltochar = new char[len];
amx_GetString(celltochar, addr, 0, len);
--len;
for(len; len>0; --len)
{
if(celltochar[len]==' ')
{
delete[] celltochar;
return len;
}
}
delete[] celltochar;
}
else { logprintf("[MULTILINE] Values of \"strarray\"sent to \"lastspace\" MUST be greater than 0."); }
return 1;
}
//[END OF NATIVE FUNCTIONS]//
AMX_NATIVE_INFO PNs[] =
{
{"lastspace", lastspace},
{0, 0}
};
PLUGIN_EXPORT int PLUGIN_CALL AmxLoad( AMX *amx )
{
return amx_Register(amx, PNs, -1);
}
PLUGIN_EXPORT int PLUGIN_CALL AmxUnload( AMX *amx )
{
return AMX_ERR_NONE;
}
.DEF File:
Code:
EXPORTS
Supports
Load
Unload
AmxLoad
AmxUnload
Any help would be most appreciated. All of this stuff is under the Mozilla Public License V2.0 (might as well protect it, gonna release it when it's done anyways).