<tfoot id='95l9W'></tfoot>
  • <i id='95l9W'><tr id='95l9W'><dt id='95l9W'><q id='95l9W'><span id='95l9W'><b id='95l9W'><form id='95l9W'><ins id='95l9W'></ins><ul id='95l9W'></ul><sub id='95l9W'></sub></form><legend id='95l9W'></legend><bdo id='95l9W'><pre id='95l9W'><center id='95l9W'></center></pre></bdo></b><th id='95l9W'></th></span></q></dt></tr></i><div id='95l9W'><tfoot id='95l9W'></tfoot><dl id='95l9W'><fieldset id='95l9W'></fieldset></dl></div>
  • <legend id='95l9W'><style id='95l9W'><dir id='95l9W'><q id='95l9W'></q></dir></style></legend>

        <bdo id='95l9W'></bdo><ul id='95l9W'></ul>

      1. <small id='95l9W'></small><noframes id='95l9W'>

        Lua 5.3 未定义的引用

        Lua 5.3 undefined references(Lua 5.3 未定义的引用)

          <tbody id='JeQE1'></tbody>

          <i id='JeQE1'><tr id='JeQE1'><dt id='JeQE1'><q id='JeQE1'><span id='JeQE1'><b id='JeQE1'><form id='JeQE1'><ins id='JeQE1'></ins><ul id='JeQE1'></ul><sub id='JeQE1'></sub></form><legend id='JeQE1'></legend><bdo id='JeQE1'><pre id='JeQE1'><center id='JeQE1'></center></pre></bdo></b><th id='JeQE1'></th></span></q></dt></tr></i><div id='JeQE1'><tfoot id='JeQE1'></tfoot><dl id='JeQE1'><fieldset id='JeQE1'></fieldset></dl></div>

              <legend id='JeQE1'><style id='JeQE1'><dir id='JeQE1'><q id='JeQE1'></q></dir></style></legend>
                <bdo id='JeQE1'></bdo><ul id='JeQE1'></ul>

                <small id='JeQE1'></small><noframes id='JeQE1'>

                  <tfoot id='JeQE1'></tfoot>
                • 本文介绍了Lua 5.3 未定义的引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试学习如何将 lua 嵌入到 C 程序中,但我不擅长阅读技术文档,而且我还没有找到任何当前的教程.这是我的程序:

                  I am trying to learn how to embed lua in a C program, but I am not great at reading technical documents, and I haven't found any current tutorials. This is my program:

                  #include <iostream>
                  #include <lua.h>
                  #include <lualib.h>
                  #include <lauxlib.h>
                  
                  
                  void report_errors(lua_State*, int);
                  
                  int main(int argc, char** argv) {
                      for (int n = 1; n < argc; ++n) {
                          const char* file = argv[n];
                          lua_State *L = luaL_newstate();
                  
                          luaL_openlibs(L);
                  
                          std::cerr << "-- Loading File: " << file << std::endl;
                  
                          int s = luaL_loadfile(L, file);
                  
                          if (s == 0) {
                              s = lua_pcall(L, 0, LUA_MULTRET, 0);
                          }
                  
                          report_errors(L, s);
                          lua_close(L);
                          std::cerr << std::endl;
                      }
                      return 0;
                  }
                  
                  void report_errors(lua_State *L, int status) {
                      if (status) {
                          std::cerr << "-- " << lua_tostring(L, -1) << std::endl;
                          lua_pop(L, 1);
                      }
                  }
                  

                  编译器给出了 luaL_newstate、luaL_openlibs、luaL_loadfilex、lua_pcallk 和 lua_close 的未定义引用错误.我在 Windows 计算机上使用 Code::Blocks one,并且已将 lua 包含目录添加到所有搜索路径,并将 liblua53.a 添加到链接库.IDE 自动完成头名称,解析器显示大部分 lua 函数,但通过简短的搜索,我发现解析器找不到 lua_newstate 或 luaL_newstate.为什么它会找到某些功能而不是其他功能?

                  The compiler gives undefined reference errors for luaL_newstate, luaL_openlibs, luaL_loadfilex, lua_pcallk, and lua_close. I am using Code::Blocks one a Windows computer and I have added the lua include directory to all of the search paths and liblua53.a to the link libraries. The IDE autocompleted the header names and the parser displays most of the lua functions, but with a brief search I found that the parser could not find either lua_newstate or luaL_newstate. Why does it find some of the functions and not others?

                  推荐答案

                  g++ 的参数在输入文件之前有 -llua.我把 -llua 放在最后,现在一切正常.

                  The arguments for g++ had -llua before the input file. I put -llua at the end, and everything works fine now.

                  这篇关于Lua 5.3 未定义的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Constructor initialization Vs assignment(构造函数初始化 Vs 赋值)
                  Is a `=default` move constructor equivalent to a member-wise move constructor?(`=default` 移动构造函数是否等同于成员移动构造函数?)
                  Has the new C++11 member initialization feature at declaration made initialization lists obsolete?(声明时新的 C++11 成员初始化功能是否使初始化列表过时了?)
                  Order of constructor call in virtual inheritance(虚继承中构造函数调用的顺序)
                  How to use sfinae for selecting constructors?(如何使用 sfinae 选择构造函数?)
                  Initializing a union with a non-trivial constructor(使用非平凡的构造函数初始化联合)
                  • <bdo id='oKyIM'></bdo><ul id='oKyIM'></ul>

                      <tbody id='oKyIM'></tbody>

                        <small id='oKyIM'></small><noframes id='oKyIM'>

                        <legend id='oKyIM'><style id='oKyIM'><dir id='oKyIM'><q id='oKyIM'></q></dir></style></legend>
                        <tfoot id='oKyIM'></tfoot>

                        • <i id='oKyIM'><tr id='oKyIM'><dt id='oKyIM'><q id='oKyIM'><span id='oKyIM'><b id='oKyIM'><form id='oKyIM'><ins id='oKyIM'></ins><ul id='oKyIM'></ul><sub id='oKyIM'></sub></form><legend id='oKyIM'></legend><bdo id='oKyIM'><pre id='oKyIM'><center id='oKyIM'></center></pre></bdo></b><th id='oKyIM'></th></span></q></dt></tr></i><div id='oKyIM'><tfoot id='oKyIM'></tfoot><dl id='oKyIM'><fieldset id='oKyIM'></fieldset></dl></div>