2013-07-06 167 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