SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Closed Thread
 
Thread Tools Display Modes
Old 17/05/2013, 04:45 PM   #1
Aeonosphere
Little Clucker
 
Join Date: May 2013
Posts: 17
Reputation: 5
Post A few SDK issues...

Sorry to ****** -> 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:
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 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;
}

.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).
Aeonosphere is offline  
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
A few SDK issues... Aeonosphere Scripting Help 0 17/05/2013 04:37 PM
Some issues SDraw Bug Reports 1 01/12/2011 01:33 PM
2 issues nuriel8833 Help Archive 13 17/04/2011 08:56 AM
2 Bad Issues :( Rokzlive Help Archive 2 25/02/2011 08:25 PM


All times are GMT. The time now is 05:26 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.