2013-07-06 150 views
0

我想编译我从这个link得到的luabind。我做luabind编译错误发生

mkdir build 
cmake .. 
make VERBOSE=1 

后 “的cmake ..” 产生这些线,

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

“让VERBOSE = 1” 产生以下错误。

/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 

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

回答

0

我只是检查出该项目在修订05c84a034e并且把它建立在Mac OS X下面是CMake的告诉我,在配置时:

-- 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应该包含:

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11") 

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

+0

我有提升1.53和Lua5.2。 – MWH

+0

尝试做'VERBOSE = 1'并将确切的编译行添加到您的问题。另外,什么操作系统? –

+0

我将编辑行添加到问题中。我正在使用Ubuntu 12.04。 – MWH