lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Are you compiling it as C++? Lua compiles both as ANSI C and as valid C++, it does _not_ declare its external functions extern "C" as most others do. This is by purpose.

You may use the etc/lua.hpp header, to have the extern declarations.

-asko kirjoitti 17.9.2006 kello 23.27:

Hello all,

I'm having some difficulty creating a Static Libary (lua.lib) in Visual C++ 2005 using Lua 5.11 and compiling it from source.

When I compile Lua and get the lua.lib it seems to generate the library.. If I use that lib to link with a test program I get the following errors:

luaadd.obj : error LNK2019: unresolved external symbol _lua_close referenced in function _main

unresolved external symbol _lua_settop referenced in function "int __cdecl luaadd(int,int)" (?luaadd@@YAHHH@Z)

and a bunch of other errors of missing symbols.

As a test, I downloaded the lua5_1_Win32_vc8.tar and used lua5.1.lib in my test program and it linked fine and worked.

What am I doing wrong when I compile the static lib from scratch?

I'm rather confused, as I was able to compile it as an executable and run some of the test.lua scripts fine (lua.exe) When I change the option to lib it seems it is leaving out some important symbols. Is there something I'm missing in the project file?

Thank you for your time,