我在 CMakeLists.txt 中添加了以下几行:
find_package(Lua51 REQUIRED)
include_directories(${LUA_INCLUDE_DIRS})
target_link_libraries(cmqhd ${LUA_LIBRARIES} ${Boost_LIBRARIES} ${GOBJECT_LIBRARIES} -lntl -lm -lgmp )
我仍然得到一个错误:
In file included from /home/kirill/Dropbox/work/dev/cmqhd/source/main.cc:10:0:
/home/kirill/Dropbox/work/dev/cmqhd/source/lua_read.h:9:17: fatal error: lua.h: No such file or directory
compilation terminated.
make[2]: *** [CMakeFiles/cmqhd.dir/source/main.cc.o] Error 1
make[1]: *** [CMakeFiles/cmqhd.dir/all] Error 2
make: *** [all] Error 2
文件 lua_read.h 具有以下标头:
#ifndef LUA_READ_H
#define LUA_READ_H
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <lua.hpp>
...
更新 (1)
g++ main.C -I/usr/include/lua5.1/ -llua5.1
编译