Skip to content

Commit 14206be

Browse files
committed
luajit.cpp
1 parent ee100ef commit 14206be

1 file changed

Lines changed: 21 additions & 4 deletions

File tree

section4/luajit.cpp

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,29 @@
11
// Copyright (c) 2020 by Chrono
22
//
3-
// g++ luajit.cpp -std=c++11 -o a.out;./a.out
4-
// g++ luajit.cpp -std=c++14 -o a.out;./a.out
5-
// g++ luajit.cpp -std=c++14 -I../common -o a.out;./a.out
3+
// g++ luajit.cpp -std=c++11 -I/usr/local/include/luajit-2.1 -lluajit-5.1 -ldl -o a.out;./a.out
4+
//
5+
// g++ luajit.cpp -std=c++11 -I/usr/local/include/luajit-2.1 /usr/local/lib/libluajit-5.1.a -ldl -o a.out;./a.out
6+
// g++ luajit.cpp -std=c++11 -I/usr/local/include/luajit-2.1 -L/usr/local/lib -Wl,-rpath,/usr/local/lib -lluajit-5.1 -ldl -o a.out;./a.out
7+
//
68

9+
#include <cassert>
710
#include <iostream>
811

9-
#include <luajit-2.1/luajit.h>
12+
extern "C" {
13+
#include <luajit.h>
14+
#include <lualib.h>
15+
#include <lauxlib.h>
16+
}
17+
18+
void case1()
19+
{
20+
auto L = luaL_newstate();
21+
assert(L);
22+
23+
luaL_openlibs(L);
24+
25+
lua_close(L);
26+
}
1027

1128
int main()
1229
{

0 commit comments

Comments
 (0)