【问题标题】:How to add lua5.1 to CMakeLists.txt? error: lua.hpp is not found如何将 lua5.1 添加到 CMakeLists.txt?错误:未找到 lua.hpp
【发布时间】:2012-06-07 16:36:15
【问题描述】:

我在 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               

编译

【问题讨论】:

  • LUA_INCLUDE_DIRS 实际上包含任何内容吗?
  • @NicolBolas 不确定如何检查,名称出现在查找文件中。

标签: c++ lua cmake


【解决方案1】:

${LUA_INCLUDE_DIR} 而不是${LUA_INCLUDE_DIRS}(目录,不是目录)

【讨论】:

    猜你喜欢
    • 2020-03-06
    • 1970-01-01
    • 1970-01-01
    • 2020-12-13
    • 2021-01-19
    • 2019-12-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多