MettaurSp
MettaurSp

Reputation: 11

C++ Unresolved External Symbols Embedded Lua

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?

Upvotes: 1

Views: 5565

Answers (1)

Coert Metz
Coert Metz

Reputation: 902

Next to setting the linker directory, you also need to provide the actual libraries to link against to your linker.

Upvotes: 3

Related Questions