我在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
编译
答案 0 :(得分:1)
${LUA_INCLUDE_DIR}
代替${LUA_INCLUDE_DIRS}
(dir,而不是dirS)