I cannot call aux functions, linker error, please help!

Skip to first unread message

Jay Kay

Jan 18, 2015, 8:27:53 PM1/18/15
to pawns...@googlegroups.com
Hello everyone.

I am trying to create a very simple console c++ app to eventually run pawn scripts.  

I #include "amx.h" #include "amxaux.h" 
and add the directory "C:\Program Files (x86)\Pawn\source\amx" to  my include path.. This works fine, as I can now see the functions and whatnot in the intellisense and build my project.

Next, I add the directory "C:\Program Files (x86)\Pawn\source\amxdll" to my project,
and then #pragma comment(lib, "amx32m.lib").

Here is my code.

#include <iostream>
#include <stdlib.h>
#include "amx.h"
#include "amxaux.h"

using namespace std;
#pragma comment(lib, "amx32m.lib")

int main(int argc, char* argv[])
// Step 1 create the virtual machine.
extern AMX_NATIVE_INFO console_Natives[];
extern AMX_NATIVE_INFO core_Natives[];

AMX amx;
cell ret = 0;
int err;

if (argc != 2)
cout << argv[0];

// ** I get a linker error when I uncomment this next line **

//err = aux_LoadProgram(&amx, argv[1], NULL);

return 0;

When I try to call aux_LoadProgram I get an error LNK2019: unresolved external symbol.

I do not understand what I am doing wrong some please assist me!

Thank you so much in advance

Tim Potze

Apr 11, 2015, 10:59:34 AM4/11/15
to pawns...@googlegroups.com
Function aux_LoadProgram allocates memory for the abstract machine, loads the compiled pseudo-code and initializes the lot. This function is not part of the pawn core, just because of what it does: memory allocation and file i/o. Therefore, the function aux_LoadProgram is implemented in a separate source file and prefixed with “aux_”, rather than “amx_” (“aux” stands for auxiliary).

amxaux is not parth of the amx32 library.
Add amxaux.c to your project. 

Jay Kay

Apr 11, 2015, 11:22:11 AM4/11/15
to pawns...@googlegroups.com
Thank you so much!!!
Reply all
Reply to author
0 new messages