LUA 编译错误与 Visual 2010"外部符号"结构lua_State * __cdecl luaL_newstate(无效)"
LUA compile error with Visual 2010 "external symbol "struct lua_State * __cdecl luaL_newstate(void)"
当我编译下面的代码时,我将Lua ver 5.2.3与Visual Studio 2010一起使用
#include "stdafx.h"
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
#include <stdlib.h>
#include <stdio.h>
void main()
{
lua_State *luaState = luaL_newstate();
}
我收到错误
error LNK2019: unresolved external symbol "struct lua_State * __cdecl luaL_newstate(void)" (?luaL_newstate@@YAPAUlua_State@@XZ) referenced in function _wmain
你能给我任何建议吗?谢谢!!!
这是
C++"名称重整"的结果。 看看这个术语中是如何有奇怪的字符的:
?luaL_newstate@@YAPAUlua_State@@XZ
您可以选择:
将此文件的文件扩展名更改为 .c 而不是 .cpp,以便它通过 C 编译器而不是C++编译器运行(警告:取决于编译器)
或
在包含周围添加外部"C",如下所示:
extern "C"
{
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
}
或
#include "lua.hpp"
在最后一种情况下,该标头包含在 5.2 版本中。它为您执行我在选项 2 中编写的内容。
相关文章:
- 递归模板化函数不能分配给具有常量限定类型"const tt &"的变量"state"
- MINGW - 正确运行函数所需的 cdecl
- 如何修复" State Error (active) E0513 a value of type "const wchar_t *" cannot be assigned to an entity o
- 为什么SADWinowSize_slider的跟踪栏的值在分配给 sbm->state 时变为 0。SADWindowSize,在我的代码中
- "State pattern" vs "one member function per state" ?
- ODBC 错误"String data, right truncation State code: 22001"与 SQL Server 数据库
- Qt state machine
- C#:Cdecl-DllExport,参数中有一个指向类实例的指针
- 如何确定State模式的状态
- 使用char**的Pinvoke cdecl约定
- C++ 中的'retain state'是什么意思?
- C# GetFunctionPointerForDelegate cdecl instead of stdcall
- 如何在Flash Player中触发"running state"?
- State of a QTcpSocket
- 内联组装 - cdecl 并准备堆栈
- GCC"__attribute__((纯))"关于"input state"吸气剂方法的建议 - 正确吗?
- 对State::State(State)没有匹配的函数调用
- cdecl错误:之前应为初始值设定项
- 使用分隔符通过'Street; City; State; Country'将每个区域存储到不同的变量中来解析地址
- Qt - QCheckBox不发出stateChanged(int state)信号