The most likely cause is that the Lua lib compiles as a C library, but lua.h is not surrounded by extern "C", and your project is probably a C++ project, which will compile lua.h as C++, thereby causing linker errors when it can't find the C++ name mangled version of the lua API.
To solve this, include lua.hpp (like someone has already suggested).
From: email@example.com [mailto:firstname.lastname@example.org] On Behalf Of Remo Dentato
Sent: Saturday, December 20, 2008 4:58 PM
Subject: Linking lua lib with Microsoft VS2005
On Windows I usually use mingw to compile and link Lua but this time I have to use Visual Studio 2005.
I can easily compile the lua51.DLL and the 2 executables (lua.exe and luac.exe) with the luavs.bat script in the etc directory of the distribution package. Everything works fine, the interpreter runs and so on.
I can also modify that script to compile Lua as a static library lua51.lib and link it to lua.exe and luac.exe. Again everything works fine.
The problem is when I try to link the library to the larger program I'm working on. I get the LNK2019 error (symbol unresolved).
I tried both with the DLL and with the static .lib but I had no success.
I checked with dumpbin and the symbols are in the library. Everything has been compiled as C using the /Tc and /TC switches.
I don't know where else to look! Does anyone have a suggestion?? Is there any flag I should use that I might have missed?
check out the rest of the Windows Live™. More than mail–Windows Live™ goes way beyond your inbox. More than messages