2014-09-19 215 views
1

我使用Ubuntu 12.04和gcc 4.8,我gfortran剛剛更新到4.8,有些我不能編譯它,這裏是錯誤:無法編譯

In file included from /home/rtbkit/local/include/boost/tuple/tuple.hpp:33:0, 
      from ./jml/boosting/tools/boosting_tool_common.h:16, 
      from ./jml/boosting/tools/boosting_tool_common.cc:10: 
/home/rtbkit/local/include/boost/tuple/detail/tuple_basic.hpp: In function 'typename boost::tuples::access_traits<typename boost::tuples::element<N, boost::tuples::cons<HT, TT> >::type>::const_type boost::tuples::get(const boost::tuples::cons<HT, TT>&)': 
/home/rtbkit/local/include/boost/tuple/detail/tuple_basic.hpp:228:31: error: typedef 'cons_element' locally defined but not used [-Werror=unused-local-typedefs] 
typedef BOOST_DEDUCED_TYPENAME impl::type cons_element; 
             ^
In file included from /home/rtbkit/local/include/boost/multi_array/concept_checks.hpp:21:0, 
      from /home/rtbkit/local/include/boost/multi_array/base.hpp:28, 
      from /home/rtbkit/local/include/boost/multi_array.hpp:21, 
      from ./jml/boosting/classifier.h:20, 
      from ./jml/boosting/tools/boosting_tool_common.cc:14: 
/home/rtbkit/local/include/boost/concept_check.hpp: In function 'void boost::function_requires (Model*)': 
/home/rtbkit/local/include/boost/concept_check.hpp:45:113: error: typedef 'boost_concept_check45' locally defined but not used [-Werror=unused-local-typedefs] 
    BOOST_CONCEPT_ASSERT((Model)); 

^ 
    typedef typename Array::index_range index_range; 
            ^
/home/rtbkit/local/include/boost/multi_array/concept_checks.hpp:43:37: error: typedef 'index' locally defined but not used [-Werror=unused-local-typedefs] 
    typedef typename Array::index index; 
           ^
/home/rtbkit/local/include/boost/multi_array/concept_checks.hpp: In static member function 'static void boost::multi_array_concepts::detail::idgen_helper<0ul>::call(Array&, const IdxGen&, Call_Type)': 
             ^
    In file included from /home/rtbkit/local/include/boost/regex/v4/regex.hpp:79:0, 
      from /home/rtbkit/local/include/boost/regex.hpp:31, 
      from ./jml/boosting/tools/boosting_tool_common.cc:18: 
/home/rtbkit/local/include/boost/regex/v4/regex_format.hpp: In member function 'OutputIter boost::re_detail::format_functor_c_string<charT, Match, Traits>::operator()(const Match&, , boost::regex_constants::match_flag_type, const Traits&)': 

/home/rtbkit/local/include/boost/regex/v4/regex_format.hpp:1086:41: error: typedef 'char_type' locally defined but not used [-Werror=unused-local-typedefs] 
    typedef typename Match::char_type char_type; 
            ^
In file included from /home/rtbkit/local/include/boost/regex/v4/regex.hpp:166:0, 
      from /home/rtbkit/local/include/boost/regex.hpp:31, 
      from ./jml/boosting/tools/boosting_tool_common.cc:18: 
/home/rtbkit/local/include/boost/regex/v4/regex_split.hpp: In function 'std::size_t boost::regex_split(OutputIterator, std::basic_string<charT, Traits1, Alloc1>&, const boost::basic_regex<charT, Traits2>&, boost::regex_constants::match_flag_type, std::size_t)': 
/home/rtbkit/local/include/boost/regex/v4/regex_split.hpp:110:57: error: typedef 'match_allocator' locally defined but not used [-Werror=unused-local-typedefs] 
typedef typename match_results<ci_t>::allocator_type      match_allocator; 
                ^
cc1plus: all warnings being treated as errors 
make: ***  [build/x86_64/obj/jml/boosting/tools/boosting_tool_common.3ec7a8f7cea9a8b0de95729f9e9210cd.lo] Error 1 

什麼是錯我的圖書館?我檢查了gfortran的版本是4.8。

+3

嘗試禁用'-Werror =未使用本地-typedefs' – 2014-09-19 23:16:49

+0

該代碼有警告,並且你的編譯器標誌將它們視爲錯誤(這通常很好)。 – Jarod42 2014-09-19 23:22:19

+1

@ Jarod42雖然一般情況下都是這樣,但是'-Wunused-local-typedefs'通常是IMO毫無意義的。 – 2014-09-19 23:23:28

回答

3

使用GCC 4.8編譯rtbkit時會發生此錯誤。

最後爲我工作:

nano /home/rtbkit/rtbkit/Makefile 

附加的編譯標誌-Wno未使用的和本地的typedef到CXXFLAGS

CXXFLAGS += -Wno-unused-local-typedefs -Wno-deprecated ... 
+0

你能告訴我們你是如何做到這個平臺的?這可能有助於這個問題:http://stackoverflow.com/questions/26136236/compile-with-ubuntu-14-and-gcc-4-8 – arikin 2014-10-02 09:32:43

+0

哦,這是一個問題( – Denis 2014-10-02 11:11:12

+0

我已經克服了一些困難。是他們的線索: https://svn.boost.org/trac/boost/ticket/6851 - > https://dev.openwrt.org/browser/packages/libs/boost/patches/200-cstdint_missing_include .patch轉= 34635 另一個問題: Makefile.am:4:處理Libtool程序庫 'libsnappy.la' 化妝:*** [install_snappy]錯誤1 解決方案: /活潑/配置。 ac AM_INIT_AUTOMAKE([ - Wall -Werror]) here刪除 - 錯誤 但無論如何有更多的問題。所以我安裝了Ubuntu 12.4.5的VirtualBox並且遵循了它的指令。 GCC 4.6導致沒有問題。 – Denis 2014-10-02 11:17:29