I need to use lua language in my Qt-application. I add necessary files into my project and write this code:

Qt Code:
  1. #include "stdafx.h"
  2. #include "podkl.h"
  3. #include <QtWidgets/QApplication>
  4.  
  5. #pragma comment(lib, "lua52.lib")
  6.  
  7. #include <lua.hpp>
  8.  
  9. int Write(lua_State* s) {
  10. return 0;
  11. }
  12.  
  13. int main(int argc, char *argv[]) {
  14. QApplication a(argc, argv);
  15. PODKL w;
  16. w.show();
  17.  
  18. lua_State* s = luaL_newstate();
  19. luaopen_base(s);
  20.  
  21. lua_pcall(s, 0, 0, 0);
  22.  
  23. //lua_register(s, "Write", Write);
  24.  
  25.  
  26. return a.exec();
  27. }
To copy to clipboard, switch view to plain text mode 

49068-clip-32kb.png

If I compile the program that way I have a linker message:
1> main.cpp
1>main.obj : error LNK2019: unresolved external symbol lua_pcall referenced in function main
1>D:\Programming\VisualStudio\Projects\STUDYING\PO DKL\x64\Debug\\PODKL.exe : fatal error LNK1120: 1 unresolved externals
But if I launch it this way:
Qt Code:
  1. //lua_pcall(s, 0, 0, 0);
  2. lua_register(s, "Write", Write);
To copy to clipboard, switch view to plain text mode 

Then I get an error message: "Unhandled exception at 0x00007FFDA7120810 (lua52.dll) in PODKL.exe: 0xC0000005: Access violation reading location 0x0000002F0ABDA198."

I have tried to launch lua from usual console project. And I have done it. Don't know why I can't do it on Qt.

What should I do to use lua on Qt-application?
(Win 8.1, x64)