17.05.2013, 16:45
Sorry to Y_Less -> got the wrong section there buddy... regardless:
Again, I must stress this is literally just about unfamiliarity with the SA:MP PAWN SDK.
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:
.DEF File:
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).
Again, I must stress this is literally just about unfamiliarity with the SA:MP PAWN SDK.
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:
#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 PNatives[] =
{
{"lastspace", lastspace},
{0, 0}
};
PLUGIN_EXPORT int PLUGIN_CALL AmxLoad( AMX *amx )
{
return amx_Register(amx, PNatives, -1);
}
PLUGIN_EXPORT int PLUGIN_CALL AmxUnload( AMX *amx )
{
return AMX_ERR_NONE;
}
Code:
EXPORTS Supports Load Unload AmxLoad AmxUnload

