天天看點

java中使用lua腳本_如何使用OOLUA運作Lua腳本[C]

你如何在OOLUA中運作lua腳本?我的C Project目錄中有一個名為“script.lua”的腳本,我嘗試這樣做:

#include

...

void Game::init() {

OOLUA::Script vm;

vm.run_file("Scripts/script.lua");

}

我的script.lua看起來像這樣:

print("Output From Lua Script!")

我已經建構并連結到oolua.lib,每當我運作我的項目時,我都會收到以下錯誤:

1> Game.obj:錯誤LNK2019:未解析的外部符号“public:__thiscall OOLUA :: Script :: Script(void)”(?? 0Script @ OOLUA @@ QAE @ XZ)在函數“public:thiscall Game :: Game”中引用(void)“(?? 0Game @@ QAE @XZ)1> Game.obj:錯誤LNK2019:未解析的外部符号”public: thiscall OOLUA :: Script ::〜Script(void)“(?? 1Script @ OOLUA @@ QAE @ XZ)函數__unwindfunclet $ ?? 0Game @@ QAE @XZ $ 1 1> Game.obj:錯誤LNK2019:未解析的外部符号“public:bool __thiscall OOLUA :: Script :: run_file(class std :: basic_string,class std :: allocator> const&)“(?run_file @ Script @ OOLUA @@ QAE_NABV?$ basic_string @ DU?$ char_traits @ D @ std @@ V?$ allocator @ D @ 2 @@ std @@@ Z)引用在函數“private:void __thiscall Game :: init(void)”(?init @ Game @@ AAEXXZ)

我這樣做完全錯了嗎?