1

I am trying to make a game with Visual C++ 2010 with an embedded Lua engine, but I keep running into persistent unresolved external symbol errors. I put copies of all the files in the 'include' folder in the project headers folder, and I tried setting the linker library path to the Lua lib folder, as well as setting the include path to the Lua include folder, but I still am getting errors stating that the usage of a couple of Lua core functions are unresolved. I already tried quite a few solutions posted around the internet and each of which resulted in the same errors.

Output:

1>Main.obj : error LNK2019: unresolved external symbol _lua_pcall referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol _luaL_loadfile referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol _luaL_newstate referenced in function _main

Main.cpp:

#include "stdafx.h"
#include "Bubble Wars.h"

extern "C" {
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
#include "luaconf.h"
#include "lua.hpp"
}

int main()
{
    lua_State * L = lua_open();
    luaL_dofile(L,"C:/Users/Trevor/Documents/Visual Studio 2010/Projects/Bubble Wars/Bubble Wars/Main.lua");
    return 0;
}

Main.cpp is the only source file that contains any Lua references. Any reasons for the function references to be unresolved?

4

1 回答 1

3

在设置链接器目录之后,您还需要提供实际的库以链接到您的链接器。

于 2013-03-02T17:31:07.847 回答