I decided to try and write some quick and dirty code to see if I could get AS working. Well, I got the engine initilized and loaded the script, but when I go to RegisterScriptString I get an error...
Quote:
Main.obj : error LNK2001: unresolved external symbol "void __cdecl RegisterScriptString(class asIScriptEngine *)" (?RegisterScriptString@@YAXPAVasIScriptEngine@@@Z)
Debug/AngelScript_Test.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
AngelScript_Test.exe - 2 error(s), 0 warning(s)
my code...
#include <iostream>
#include <assert.h>
#include <conio.h>
#include <stdio.h>
#include <angelscript.h>
#include <scriptstring.h>
using namespace std;
// Prototypes
void PrintString(string &str);
int main(int argc, char **argv)
{
asIScriptEngine *engine = asCreateScriptEngine(ANGELSCRIPT_VERSION);
if(engine == 0)
cout << "Faild to creat Scripting Engine";
engine->SetCommonMessageStream((asOUTPUTFUNC_t)printf, 0);
// Load Script
FILE *f = fopen("test.as", "rb");
//int length = _filelength(f);
char *script = new char[255];
fread(script,255,1,f);
fclose(f);
// Register Stuff
int r;
RegisterScriptString(engine);
r = engine->RegisterGlobalFunction("void Print(string ∈)", asFUNCTION(PrintString), asCALL_CDECL); assert( r >= 0);
// Compile Script
engine->AddScriptSection("module","section",script,255);
engine->Build("module");
asIScriptContext *ctx = engine->CreateContext();
int funcId = engine->GetFunctionIDByDecl(0,"void init()");
int a = ctx->Prepare(funcId);
cout << "Executing Script\n------\n";
ctx->Execute();
ctx->Release();
engine->Release();
system("pause");
return 0;
}
void PrintString(string &str)
{
cout << str;
}