2014-07-01 20 views
0

我安裝了英特爾ComposerXE 2013的試用版(包含ICC 14.0.1編譯器)。我的測試程序如下:爲什麼一個額外的-I標誌(包含目錄)中斷編譯? (使用英特爾編譯器)

#include <boost/graph/adjacency_list.hpp> 
#include <iostream> 

typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS> UndirectedGraph; 

int main() { 

    UndirectedGraph G(10); 

return 0; 
} 

我使用英特爾編譯器標誌如下

/home/intel/bin/icpc         //binary 
    -L/home/intel/composerxe/lib/intel64    //lib path 
    -I/home/intel/composerxe/include     //include path for ICPC 
    -I/home/boost_1_55_0        //boost path 
    -std=c++11 test.cpp        // c++11 flags 

我得到下面的錯誤BOOST HASH.hpptype_traits.hpp文件

In file included from /home/boost_1_55_0/boost/functional/hash/hash.hpp(540), 
       from /home/boost_1_55_0/boost/functional/hash.hpp(6), 
       from /home/boost_1_55_0/boost/unordered/unordered_set.hpp(20), 
       from /home/boost_1_55_0/boost/unordered_set.hpp(16), 
       from /home/boost_1_55_0/boost/graph/adjacency_list.hpp(21), 
       from test.cpp(1): 
/home/boost_1_55_0/boost/functional/hash/extensions.hpp(67): error: "hash_value" is not a function or static data member 
     std::size_t hash_value(std::complex<T> const&); 
       ^

In file included from /home/boost_1_55_0/boost/functional/hash/hash.hpp(540), 
       from /home/boost_1_55_0/boost/functional/hash.hpp(6), 
       from /home/boost_1_55_0/boost/unordered/unordered_set.hpp(20), 
       from /home/boost_1_55_0/boost/unordered_set.hpp(16), 
       from /home/boost_1_55_0/boost/graph/adjacency_list.hpp(21), 
       from test.cpp(1): 
/home/boost_1_55_0/boost/functional/hash/extensions.hpp(121): error: "hash_value" is not a function or static data member 
     std::size_t hash_value(std::complex<T> const& v) 
       ^

In file included from /home/boost_1_55_0/boost/functional/hash/hash.hpp(540), 
       from /home/boost_1_55_0/boost/functional/hash.hpp(6), 
       from /home/boost_1_55_0/boost/unordered/unordered_set.hpp(20), 
       from /home/boost_1_55_0/boost/unordered_set.hpp(16), 
       from /home/boost_1_55_0/boost/graph/adjacency_list.hpp(21), 
       from test.cpp(1): 
/home/boost_1_55_0/boost/functional/hash/extensions.hpp(277): warning #12: parsing restarts here after previous syntax error 
     }; 
    ^

In file included from /home/boost_1_55_0/boost/type_traits.hpp(49), 
       from /home/boost_1_55_0/boost/pending/property.hpp(13), 
       from /home/boost_1_55_0/boost/graph/graph_traits.hpp(27), 
       from /home/boost_1_55_0/boost/graph/adjacency_list.hpp(33), 
       from test.cpp(1): 
/home/boost_1_55_0/boost/type_traits/is_complex.hpp(23): error #303: explicit type is missing ("int" assumed) 
    is_convertible_from_tester(const std::complex<T>&); 
            ^

In file included from /home/boost_1_55_0/boost/type_traits.hpp(49), 
       from /home/boost_1_55_0/boost/pending/property.hpp(13), 
       from /home/boost_1_55_0/boost/graph/graph_traits.hpp(27), 
       from /home/boost_1_55_0/boost/graph/adjacency_list.hpp(33), 
       from test.cpp(1): 
/home/boost_1_55_0/boost/type_traits/is_complex.hpp(23): error: qualified name is not allowed 
    is_convertible_from_tester(const std::complex<T>&); 
            ^

In file included from /home/boost_1_55_0/boost/type_traits.hpp(49), 
       from /home/boost_1_55_0/boost/pending/property.hpp(13), 
       from /home/boost_1_55_0/boost/graph/graph_traits.hpp(27), 
       from /home/boost_1_55_0/boost/graph/adjacency_list.hpp(33), 
       from test.cpp(1): 
/home/boost_1_55_0/boost/type_traits/is_complex.hpp(23): error: expected a ")" 
    is_convertible_from_tester(const std::complex<T>&); 
               ^

In file included from /home/boost_1_55_0/boost/type_traits.hpp(49), 
       from /home/boost_1_55_0/boost/pending/property.hpp(13), 
       from /home/boost_1_55_0/boost/graph/graph_traits.hpp(27), 
       from /home/boost_1_55_0/boost/graph/adjacency_list.hpp(33), 
       from test.cpp(1): 
/home/boost_1_55_0/boost/type_traits/is_complex.hpp(22): warning #488: template parameter "T" is not used in declaring the parameter types of function template "boost::detail::is_convertible_from_tester::is_convertible_from_tester" 
    template <class T> 
        ^

現在編譯的代碼我在沒有ICPC的情況下使用此編譯INCLUDE PATH

/home/intel/bin/icpc         //binary 
    -L/home/intel/composerxe/lib/intel64    //lib path 
        //removed the ICPC INCLUDE PATH HERE 
    -I/home/boost_1_55_0        //boost path 
    -std=c++11 test.cpp        // c++11 flags 

這個編譯就好了ZERO錯誤

爲什麼會發生這種情況?

我的LD_LIBRARY_PATHPATH變量爲空。沒有GCC或其路徑設置的其他編譯器。我正在編譯期間提供所有的路徑。

+0

你會不會通過任何機會,有下安裝升壓版本'/家庭/英特爾/ composerxe/include'? – rodrigo

回答

1

可能在給定的目錄中有一些文件與其他文件具有相同的名稱,當它包含#included時,編譯將失敗或成功,具體取決於選擇這兩個同名文件。

要驗證是否出現這種情況,請使用選項-H編譯這兩種情況,它將列出所有包含的文件並比較輸出。

爲了解決這個問題,而刪除目錄,將其移動到命令行的末尾:

/home/intel/bin/icpc         //binary 
    -L/home/intel/composerxe/lib/intel64    //lib path 
    -I/home/boost_1_55_0        //boost path 
    -I/home/intel/composerxe/include     //include path for ICPC 
    -std=c++11 test.cpp        // c++11 flags 
+0

是的。 -H選項起作用。我發現包含math.h,來自兩個位置的複雜文件。如果我不提供包含路徑,它工作正常。如果我提供路徑,還會包含其他一些文件,因爲它會顯示錯誤。英特爾編譯器包含路徑有點棘手,不需要提供任何包含路徑。感謝您的想法! – Pogo

相關問題