首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >出现luabind编译错误

出现luabind编译错误
EN

Stack Overflow用户
提问于 2013-07-06 09:44:57
回答 1查看 766关注 0票数 0

我正试图编译从这个链接中得到的luabind。在我做完

代码语言:javascript
复制
mkdir build
cmake ..
make VERBOSE=1

"cmake .“产生这些线条,

代码语言:javascript
复制
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++-4.7
-- Check for working CXX compiler: /usr/bin/g++-4.7 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Boost version: 1.53.0
-- Found Lua52: /usr/lib/i386-linux-gnu/liblua5.2.so;/usr/lib/i386-linux-gnu/libm.so 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mwh/Desktop/Downloads/luabind-master/build

"make VERBOSE=1“会产生以下错误。

代码语言:javascript
复制
/usr/bin/cmake -H/home/mwh/Desktop/Downloads/luabind-master -B/home/mwh/Desktop/Downloads/luabind-master/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/mwh/Desktop/Downloads/luabind-master/build/CMakeFiles /home/mwh/Desktop/Downloads/luabind-master/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/home/mwh/Desktop/Downloads/luabind-master/build'
make -f src/CMakeFiles/luabind.dir/build.make src/CMakeFiles/luabind.dir/depend
make[2]: Entering directory `/home/mwh/Desktop/Downloads/luabind-master/build'
cd /home/mwh/Desktop/Downloads/luabind-master/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/mwh/Desktop/Downloads/luabind-master /home/mwh/Desktop/Downloads/luabind-master/src /home/mwh/Desktop/Downloads/luabind-master/build /home/mwh/Desktop/Downloads/luabind-master/build/src /home/mwh/Desktop/Downloads/luabind-master/build/src/CMakeFiles/luabind.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/home/mwh/Desktop/Downloads/luabind-master/build'
make -f src/CMakeFiles/luabind.dir/build.make src/CMakeFiles/luabind.dir/build
make[2]: Entering directory `/home/mwh/Desktop/Downloads/luabind-master/build'
/usr/bin/cmake -E cmake_progress_report /home/mwh/Desktop/Downloads/luabind-master/build/CMakeFiles 2
[  1%] Building CXX object src/CMakeFiles/luabind.dir/class.cpp.o
cd /home/mwh/Desktop/Downloads/luabind-master/build/src && /usr/bin/g++-4.7    -I/usr/local/include -I/usr/include/lua5.2 -I/home/mwh/Desktop/Downloads/luabind-master    -o CMakeFiles/luabind.dir/class.cpp.o -c /home/mwh/Desktop/Downloads/luabind-master/src/class.cpp
In file included from /home/mwh/Desktop/Downloads/luabind-master/luabind/object.hpp:38:0,
                 from /home/mwh/Desktop/Downloads/luabind-master/luabind/scope.hpp:28,
                 from /home/mwh/Desktop/Downloads/luabind-master/luabind/class.hpp:92,
                 from /home/mwh/Desktop/Downloads/luabind-master/src/class.cpp:30:
/home/mwh/Desktop/Downloads/luabind-master/luabind/detail/policy.hpp: In member function ‘T luabind::detail::enum_converter::apply(lua_State*, luabind::detail::by_value<T>, int)’:
/home/mwh/Desktop/Downloads/luabind-master/luabind/detail/policy.hpp:498:21: error: ‘underlying_type’ in namespace ‘std’ does not name a type
/home/mwh/Desktop/Downloads/luabind-master/luabind/detail/policy.hpp:499:47: error: expected type-specifier before ‘integral_t’
/home/mwh/Desktop/Downloads/luabind-master/luabind/detail/policy.hpp:499:47: error: expected ‘>’ before ‘integral_t’
/home/mwh/Desktop/Downloads/luabind-master/luabind/detail/policy.hpp:499:47: error: expected ‘(’ before ‘integral_t’
/home/mwh/Desktop/Downloads/luabind-master/luabind/detail/policy.hpp:499:47: error: ‘integral_t’ was not declared in this scope
/home/mwh/Desktop/Downloads/luabind-master/luabind/detail/policy.hpp:499:83: error: expected ‘)’ before ‘;’ token
make[2]: *** [src/CMakeFiles/luabind.dir/class.cpp.o] Error 1
make[2]: Leaving directory `/home/mwh/Desktop/Downloads/luabind-master/build'
make[1]: *** [src/CMakeFiles/luabind.dir/all] Error 2
make[1]: Leaving directory `/home/mwh/Desktop/Downloads/luabind-master/build'
make: *** [all] Error 2

我该怎么做才能纠正这个问题?我在Ubuntu12.04中使用gcc 4.7.3,boost 1.53,Lua 5.2。请帮帮忙。

EN

回答 1

Stack Overflow用户

发布于 2013-07-06 10:47:55

我刚刚在修订版05c84a034e上查看了这个项目,并在Mac上构建了它。下面是CMake在配置时告诉我的:

代码语言:javascript
复制
-- The CXX compiler identification is GNU 4.7.3
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Check for working CXX compiler: /opt/local/bin/g++ -- works
-- Detecting CXX compiler ABI info - done
-- Boost version: 1.53.0
-- Found Lua52: /opt/local/lib/liblua.dylib;  

所以我有GCC 4.7.3,推高1.53,Lua 5.2。我看你也有GCC 4.7.3,但是Boost和Lua呢?

编辑:下面是我从make VERBOSE=1为第一个文件编译的行:

g++ -Wall -std=c++11 -pedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wno-deprecated-declarations -o CMakeFiles/luabind.dir/class.cpp.o -c class.cpp

另一方面,你展示了这个:

g++-4.7 -o CMakeFiles/luabind.dir/class.cpp.o -c class.cpp

所以问题是,你的编译器标志到哪里去了?顶级CMakeLists.txt应该包含以下内容:

代码语言:javascript
复制
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11")

再来一堆。因为你没有设置这些标志,你需要找出原因。您可以尝试在message("I am here")中添加一些CMakeLists.txt调试语句,然后从头开始运行cmake,以查看配置的预期部分是否正在执行。这里的关键是您的编译行缺少-std=c++11--这就是您获得错误的原因。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17501683

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档