Search code examples
visual-c++compilationlualuajit

Error when compiling with luajit and lua-iup libs [visual c++ 2012]


I wrote an app with luajit and lua-iup, and link my app with static libs. But I got the following error:

------ Build started: Project: ConsoleApplication1, Configuration: Release Win32 ------
     Creating library C:\Users\root\Documents\Visual Studio 2012\Projects\ConsoleApplication1\Release\ConsoleApplication1.lib and object C:\Users\root\Documents\Visual Studio 2012\Projects\ConsoleApplication1\Release\ConsoleApplication1.exp
iup.lib(iupwindows_main.obj) : error LNK2001: unresolved external symbol _main
C:\Users\root\Documents\Visual Studio 2012\Projects\ConsoleApplication1\Release\ConsoleApplication1.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Am I missing some libs and any idea about this?


Solution

  • Here is the answer form the author of IUP, hope this would be helpful to someone that met the same problem as me

    It seems that you are building a console application. This means you need a “main” function. If you try instead to build a Windows application without a console, then IUP will implement the WinMain function for you and call your “main” function. In both cases you need the “main” function.