lua-users home
lua-l archive

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

2013/3/10 Choonster TheMage <>:
> I'm writing a library that depends on lua-zlib[1], but I'm having a
> hard time compiling it on Windows. I've tried doing it Visual Studio
> 2012, but I really have no idea what I'm doing.
> When I try to compile it in VS, I get a bunch of linker errors telling
> me that symbols can't be found (these are things defined in lua.h,
> lauxlib.h or zlib.h). VS can find the header files that define these
> symbols without issue, but it seems the linker can't find the files it
> needs.
> Can anyone tell me how to compile lua-zlib (and C libraries in
> general) on Windows? I'm open to using VS2012, Cygwin, MinGW or pretty
> much anything else.

To be able to use the Lua and zlib DLLs, the compiler need the
headers, and the (VS) linker need import libraries (it's a kind of
static libraries that don't contain much code but will instead load
the corresponding DLL at runtime). You should find these libraries
either in precompiled packages you download or they are generated by
the compiler if you built Lua and zlib yourself. You need to specify
lua51.lib and zlib1.lib (or whatever their name in your system) to the
linker in the link property pages in Visual Studio. Note that you may
have to specify the file names (without path) and the directory they
are in in different properties (though I think specifying absolute
paths in the library list is OK).

The same is true for other compilers and linkers, with subtle
differences. MinGW for example can use the DLL files directly without
import libraries, but you will need to point at these DLLs in the
linker options nonetheless.