如何使用Visual Studio 2012设置LuaBind? [英] How do you set up LuaBind with visual studio 2012?

查看:117
本文介绍了如何使用Visual Studio 2012设置LuaBind?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试了一天.我已经阅读了文档,并在网上搜索以寻求帮助.我只是似乎无法弄清楚在预编译标头使用的不同版本的boost/lua/luabind与VS2010与VS2012之间的区别.

我在这里找到了一个很棒的网站 http://blog.nuclex-games.com/tutorials/cxx/luabind-简介/ 但是当我按照这些说明进行操作时,我得到LNK2019错误(我想是因为他为VS2010构建了luabind/boost/lua.

我也发现了这个, http://urbsch.at/?read=1 该项目并将地址更改为我的boost/lua文件,它可以正常编译,但是当我尝试运行使用luabind的项目时,我仍然收到LNK2019错误.

我正在使用Visual Studios2012.如果有人可以逐步列出一些说明,我将非常感激.在项目属性中包括要下载的内容以及在何处以及要添加什么内容.因为在这一点上,如果不是万无一失,我敢肯定会把它弄乱.

这些是我经常遇到的49个错误之一.

1> ScriptManager.obj:错误LNK2019:在函数"public"中引用了未解析的外部符号_lua_gettop:__thiscall luabind :: adl :: index_proxy :: index_proxy(class luabind :: adl :: object const&,struct lua_State *, char const(&)[13])(?? $?0 $$ BY0N @ $$ CBD @?$ index_proxy @ Vobject @ adl @ luabind @@@ adl @ luabind @@ QAE @ ABVobject @ 12 @ PAUlua_State @ @ AAY0N @ $$ CBD @ Z)

解决方案

好,我已经弄清楚了. >

1)从此处下载演示 http://blog.nuclex- games.com/tutorials/cxx/luabind-introduction/

2)创建一个新文件(例如"Parts")以保存luabind必需的三个部分.

3)从上面的下载中打开参考文件夹,并将这3个文件夹移到您刚创建的"Parts"文件夹中.

4)现在,您需要为Lua和LuaBind重新编译新的.lib文件.从上面的下载中打开LibrarySources.7z文件.

4)创建一个新的名为Lua的Visual Studio 2012项目,将"LibrarySources.7z/lua-5.2.0/src"中的所有文件打开解压缩到Visual Studio通常放置.cpp和.h文件的位置. /p>

5)将文件添加到项目中(项目资源管理器的头文件夹中的.h文件和源文件夹中的.c文件).

6)转到SolutionExplorer-> Properties-> General-> Configuration_Type并将其设置为静态库(.lib)

7)编译项目.

8)转到lua项目的文件夹debug文件夹,然后将创建的lua.lib文件归档.

9)现在转到创建为"Parts/Lua"的"Parts"文件夹,您应该在那里看到2个文件夹,它们分别为msvc-10.0-x64/86,创建一个新文件夹,其名称为msvc-11.0-x86,然后放入您刚刚在其中创建的lua.lib文件.

10)对于luabind,您需要执行相同的操作,但是只需要将luabind的src文件夹提取到您的项目中即可.

11)现在在项目属性C/C ++->其他包含目录中,添加"C:/Parts/boost/include""C:/Parts/lua/include"和"C:/Parts/luabind/include"

12)现在转到链接器->常规->其他库目录,并添加"C:/Parts/lua/msvc-11.0-x86"

13)现在返回解决方案资源管理器->属性->常规,并将其更改为静态库.

14)编译该文件,转到其调试文件夹,然后像对lua一样,将您创建的luabind.lib添加到parts/luabind/msvs-11.0-x86.

15)现在,在您的项目中,要使用luabind,请转到属性"->"C/C ++"->常规"并添加"C:/Parts/boost/include""C:/Parts/lua/include "和"C:/Parts/luabind/include"

16)转到属性"->链接器"->通用"->其他库目录",然后将地址添加到刚创建的两个.lib文件中.

芬.

I've been trying to do this for a day. I've read through the documentation, and searched online for help. I just can't seem to figure it out between different versions of boost/lua/luabind used with precompiled headers, and VS2010 vs VS2012.

I found a great website here http://blog.nuclex-games.com/tutorials/cxx/luabind-introduction/ but when I follow those instructions I get LNK2019 errors (I'm assuming because he build luabind/boost/lua for VS2010.

I also found this, http://urbsch.at/?read=1 I took the project and changed the addresses to my boost/lua files and it compiled fine but when I tried to run my project that is using luabind I still received LNK2019 errors.

I'm using visual studios 2012. If someone could list out some step by step instructions I would be so grateful. Including what to download and where and what to add in the project properties. Because at this point I'm sure I'll mess it up if It's not foolproof.

These is one of the 49 errors I often end up with.

1>ScriptManager.obj : error LNK2019: unresolved external symbol _lua_gettop referenced in function "public: __thiscall luabind::adl::index_proxy::index_proxy(class luabind::adl::object const &,struct lua_State *,char const (&)[13])" (??$?0$$BY0N@$$CBD@?$index_proxy@Vobject@adl@luabind@@@adl@luabind@@QAE@ABVobject@12@PAUlua_State@@AAY0N@$$CBD@Z)

解决方案

Ok, I figured it out (a while ago.) Here is complete, step by step, fool proof instructions on how to get it to work.

1) Download the demo from here http://blog.nuclex-games.com/tutorials/cxx/luabind-introduction/

2) Create a new file (say "Parts") to hold the three parts neccisary for luabind.

3) Open the reference folder from the download above and move those 3 folders to the "Parts" folder you just created.

4) Now you need to recompile new .lib files for Lua and LuaBind. Open the LibrarySources.7z file from the download above.

4) Create a new Visual Studio 2012 project named Lua, open extract all the files from "LibrarySources.7z/lua-5.2.0/src" to the place visual studios usually puts your .cpp and .h files.

5) Add the files to the project (.h files in the header folder of project explorer and .c files in the source folder.)

6) Go to SolutionExplorer->Properties->General->Configuration_Type and set it to Static Library (.lib)

7) Compile the project.

8) Go to the folder debug folder of your lua project and file the lua.lib file you created.

9) Now go to the "Parts" foler you created to "Parts/Lua" You should see 2 folders there that say msvc-10.0-x64/86, create a new one that says msvc-11.0-x86 and put the lua.lib file you just created in that.

10) For luabind you need to do the same thing, however you only need to extract the src folder from luabind to your project.

11) Now in project properties C/C++ -> Additional Include Directories, add "C:/Parts/boost/include" "C:/Parts/lua/include" and "C:/Parts/luabind/include"

12) Now go to Linker->General->Additional Library Directories and add "C:/Parts/lua/msvc-11.0-x86"

13) Now go back to solution explorer->Properties->General and change it to a static lib.

14) Compile that, go to its debug folder and add the luabind.lib you created to the parts/luabind/msvs-11.0-x86 like you did for lua.

15) Now in you're project that you want to use luabind with Go to Properties->C/C++ -> General and add "C:/Parts/boost/include" "C:/Parts/lua/include" and "C:/Parts/luabind/include"

16) Go to properties->linker->general->Additional Library Directories and add the addresses to both .lib files you just made.

Fin.

这篇关于如何使用Visual Studio 2012设置LuaBind?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆