Reputation: 857
I'd like to compile Lua 5.2 alpha under visual studio but I'm getting errors and I have no clue how to fix them.
error LNK1169: one or more multiply defined symbols found
error LNK2005: _main already defined in lua.obj
I'd be grateful if anyone could guide me through the creation of a VS2010 solution for Lua 5.2 alpha, or point me to related resources.
Thanks in advance.
Upvotes: 4
Views: 3635
Reputation: 9508
You are most probably compiling both luac.c
and lua.c
in one VS project. To build Lua yourself in VS you need three projects:
library - this should be either DLL or static library project. Should include every .c file under src/ except luac.c
and lua.c
. You only need this if you are embedding.
compiler - console executable, containing luac.c
interpreter - console executable, containing lua.c
Upvotes: 13
Reputation: 146940
The Lua source distribution includes a console interpreter, which already defines main
, and you don't want that. Just look in the Lua source and delete or comment out the main
s that you find.
Upvotes: 0
Reputation: 263986
Sounds like you included lua.c, or luac.c, with another program. Each of these is a separate program with their own main. You need to include just one of them to build the standalone Lua component, or neither if you're embedding Lua in your own application.
Upvotes: 2