C++ calls lua language

C++ called lua language and tried it today.

At the beginning, I encountered some thorny problems. I checked the Internet and said that it was to be quoted, but I didn't make it clear, so I summed up my experience.

1. Open the project properties, find the C/C++ item, and add " Additional Include Directories "

Add the lua file header, as follows:

 C:\Program Files (x86)\Lua\5.1\include;

2. The same is the project property, this linker , " Additional Dependencies "

Add two lua libs, as follows:

C: \ ProgramFiles (x86) \ Lua \ 5.1 \ lib \ lua5.1.lib; C: \ ProgramFiles (x86) \ Lua \ 5.1 \ lib \ lua51.lib;

Note that the header file is referenced in the way of C++

extern "C" {
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
}

Compiled, OK

{{o.name}}
{{m.name}}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324135919&siteId=291194637