sjaakiejj
Member
|
[SOLVED] Luabind compile-time errors || Lua Scripts not executing
I'm just a bit in the dark about Luabind, as its the first time I will be using it in combination with a gaming engine. I've followed the wiki tutorial on how to add Luabind to the Esenthel Engine, and finished the first two steps without any errors. However, when I add the source-files from Luabind to the project, Esenthel starts complaining about stdafx.h not being included in the Luabind files.
The errors are as follows:
Code:
1>------ Build started: Project: ProjectFox, Configuration: Debug Win32 ------
1>Build started 8/18/2010 4:12:05 PM.
1>InitializeBuildStatus:
1> Touching "Debug\ProjectFox.unsuccessfulbuild".
1>ClCompile:
1> All outputs are up-to-date.
1> wrapper_base.cpp
1>d:\general game development\luabind\src\wrapper_base.cpp(23): warning C4627: '#include <luabind/config.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\wrapper_base.cpp(24): warning C4627: '#include <luabind/lua_include.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\wrapper_base.cpp(25): warning C4627: '#include <luabind/detail/object_rep.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\wrapper_base.cpp(26): warning C4627: '#include <luabind/detail/class_rep.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\wrapper_base.cpp(27): warning C4627: '#include <luabind/detail/stack_utils.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\wrapper_base.cpp(58): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?
1> weak_ref.cpp
1>d:\general game development\luabind\src\weak_ref.cpp(23): warning C4627: '#include <algorithm>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\weak_ref.cpp(25): warning C4627: '#include <luabind/lua_include.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\weak_ref.cpp(27): warning C4627: '#include <luabind/config.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\weak_ref.cpp(28): warning C4627: '#include <luabind/weak_ref.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\weak_ref.cpp(29): warning C4627: '#include <cassert>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\weak_ref.cpp(204): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?
1> stack_content_by_name.cpp
1>d:\general game development\luabind\src\stack_content_by_name.cpp(23): warning C4627: '#include <luabind/lua_include.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\stack_content_by_name.cpp(25): warning C4627: '#include <luabind/luabind.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\stack_content_by_name.cpp(58): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?
1> scope.cpp
1>d:\general game development\luabind\src\scope.cpp(23): warning C4627: '#include <luabind/lua_include.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\scope.cpp(25): warning C4627: '#include <luabind/scope.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\scope.cpp(26): warning C4627: '#include <luabind/detail/debug.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\scope.cpp(27): warning C4627: '#include <luabind/detail/stack_utils.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\scope.cpp(28): warning C4627: '#include <cassert>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\scope.cpp(200): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?
1> ref.cpp
1>d:\general game development\luabind\src\ref.cpp(23): warning C4627: '#include <algorithm>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\ref.cpp(24): warning C4627: '#include <luabind/config.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\ref.cpp(25): warning C4627: '#include <luabind/detail/ref.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\ref.cpp(26): warning C4627: '#include <luabind/lua_include.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\ref.cpp(27): warning C4627: '#include <luabind/detail/debug.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\ref.cpp(177): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?
1> pcall.cpp
1>d:\general game development\luabind\src\pcall.cpp(23): warning C4627: '#include <luabind/detail/pcall.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\pcall.cpp(24): warning C4627: '#include <luabind/error.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\pcall.cpp(25): warning C4627: '#include <luabind/lua_include.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\pcall.cpp(59): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?
1> overload_rep.cpp
1>d:\general game development\luabind\src\overload_rep.cpp(23): warning C4627: '#include <luabind/detail/overload_rep.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\overload_rep.cpp(38): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?
1> open.cpp
1>d:\general game development\luabind\src\open.cpp(23): warning C4627: '#include <luabind/lua_include.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\open.cpp(25): warning C4627: '#include <luabind/luabind.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\open.cpp(26): warning C4627: '#include <luabind/function.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\open.cpp(69): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?
1> object_rep.cpp
1>d:\general game development\luabind\src\object_rep.cpp(23): warning C4627: '#include <luabind/detail/object_rep.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\object_rep.cpp(24): warning C4627: '#include <luabind/detail/class_rep.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\object_rep.cpp(113): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?
1> link_compatibility.cpp
1>d:\general game development\luabind\src\link_compatibility.cpp(23): warning C4627: '#include <luabind/detail/link_compatibility.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\link_compatibility.cpp(42): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?
1> implicit_cast.cpp
1>d:\general game development\luabind\src\implicit_cast.cpp(23): warning C4627: '#include <luabind/lua_include.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\implicit_cast.cpp(25): warning C4627: '#include <luabind/luabind.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\implicit_cast.cpp(26): warning C4627: '#include <luabind/detail/implicit_cast.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\implicit_cast.cpp(63): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?
1> function.cpp
1>d:\general game development\luabind\src\function.cpp(23): warning C4627: '#include <luabind/lua_include.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\function.cpp(25): warning C4627: '#include <luabind/config.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\function.cpp(26): warning C4627: '#include <luabind/luabind.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\function.cpp(295): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?
1> find_best_match.cpp
1>d:\general game development\luabind\src\find_best_match.cpp(23): warning C4627: '#include <luabind/lua_include.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\find_best_match.cpp(25): warning C4627: '#include <luabind/luabind.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\find_best_match.cpp(84): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?
1> error.cpp
1>d:\general game development\luabind\src\error.cpp(23): warning C4627: '#include <luabind/error.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\error.cpp(77): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?
1> create_class.cpp
1>d:\general game development\luabind\src\create_class.cpp(23): warning C4627: '#include <luabind/lua_include.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\create_class.cpp(25): warning C4627: '#include <luabind/luabind.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\create_class.cpp(143): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?
1> class_rep.cpp
1>d:\general game development\luabind\src\class_rep.cpp(23): warning C4627: '#include <luabind/lua_include.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\class_rep.cpp(25): warning C4627: '#include <luabind/detail/stack_utils.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\class_rep.cpp(26): warning C4627: '#include <luabind/luabind.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\class_rep.cpp(27): warning C4627: '#include <utility>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\class_rep.cpp(734): warning C4627: '#include <sstream>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\class_rep.cpp(736): warning C4627: '#include <strstream>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\class_rep.cpp(1680): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?
1> class_registry.cpp
1>d:\general game development\luabind\src\class_registry.cpp(23): warning C4627: '#include <luabind/lua_include.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\class_registry.cpp(25): warning C4627: '#include <luabind/luabind.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\class_registry.cpp(26): warning C4627: '#include <luabind/detail/class_registry.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\class_registry.cpp(27): warning C4627: '#include <luabind/detail/class_rep.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\class_registry.cpp(28): warning C4627: '#include <luabind/detail/operator_id.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\class_registry.cpp(259): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?
1> class_info.cpp
1>d:\general game development\luabind\src\class_info.cpp(23): warning C4627: '#include <luabind/lua_include.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\class_info.cpp(25): warning C4627: '#include <luabind/luabind.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\class_info.cpp(26): warning C4627: '#include <luabind/class_info.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\class_info.cpp(77): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?
1> class.cpp
1>d:\general game development\luabind\src\class.cpp(23): warning C4627: '#include <luabind/lua_include.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\class.cpp(25): warning C4627: '#include <luabind/config.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\class.cpp(26): warning C4627: '#include <luabind/class.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\class.cpp(27): warning C4627: '#include <luabind/nil.hpp>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\class.cpp(29): warning C4627: '#include <cstring>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\class.cpp(30): warning C4627: '#include <iostream>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>d:\general game development\luabind\src\class.cpp(428): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?
1> Generating Code...
1> Compiling...
1> Game.cpp
1>Build FAILED.
1>
1>Time Elapsed 00:00:33.29
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I have a second question as well. Is it possible to get the key that was pressed, rather than just checking if a particular key has been pressed and getting a true or false back?
Thanks in advance
(This post was last modified: 08-25-2010 08:26 AM by sjaakiejj.)
|
|
08-18-2010 04:33 PM |
|
Esenthel
Administrator
|
RE: Luabind compile-time errors
if you use precompiled headers, you always need to set #include "stdafx.h" as the 1st thing in your CPP
you can disable precompiled headers for specified files by selecting them in solution explorer and adjusting compilation options
you can check Kb.c() which returns Char of current pressed key
if you wanna KB_BUTTON then you need to do REP(256) if(Kb.b(KB_BUTTON(i))) pressed_key=i;
|
|
08-18-2010 05:35 PM |
|
sjaakiejj
Member
|
RE: Luabind compile-time errors
Works like a charm, thanks so much
I'll try the Kb.c, as I'm trying to avoid clutter (a million else-if statements for all the controls isn't exactly what I want in my code), the if suggestion won't work. I'll play around with it for a bit and see what happens ^^
My compliments to the tutorials and the general engine by the way, it was surprisingly quick and easy to set it up and get going
|
|
08-18-2010 06:09 PM |
|
sjaakiejj
Member
|
RE: Luabind compile-time errors
As I didn't want to create another thread about Lua I decided to just post it here, I'm trying to execute a lua script from the player class, and do this as follows
Code:
//Before this I open the lua state and luabind etc.
//I'm guessing the problem is here.
luabind::module(playerLua)
[
luabind::class_<Player>("Player")
.def("setControls", &Player::setControls)
.def("disableGrav", &Player::disableGrav)
];
//Tried it with 'this' as well, nothing happens
luabind::globals(playerLua)["player"] = &Players[0];
//Neither of these two work
//Do File
luaL_dofile(playerLua, "Scripts/SetControls.lua");
//Do String
luaL_dostring(playerLua,
"controlsList = {1,2}\n"
"player:setControls(controlsList)\n");
Nothing happens when I run the code, the script doesn't execute at all. Perhaps I'm doing something wrong when defining the functions? Thanks in advance.
Edit:
After some double checking I found that dostring does work, so I'm thinking it might be the setControls function.
Edit2:
It seems to be the setControls function, I'll look into it.
Edit3:
Issue fixed, lua arrays are incompatible with C++ arrays, which was causing the issue.
(This post was last modified: 08-25-2010 08:26 AM by sjaakiejj.)
|
|
08-24-2010 11:05 AM |
|