2015-05-23 32 views
0

我在窗口visual studio 2013上安裝了armadillo庫。當我嘗試構建解決方案時。發生以下構建錯誤。任何幫助將不勝感激。在Windows平臺上使用Armadillo時出現錯誤

1>------ Build started: Project: ConsoleApplication1, Configuration: Debug x64 ------ 
1> Source.cpp 
1>c:\users\haixun\desktop\test_programs\testingapplication\armadillo-5.100.2\include\armadillo_bits/diskio_meat.hpp(787): error C4146: unary minus operator applied to unsigned type, result still unsigned 
1>   c:\users\haixun\desktop\test_programs\testingapplication\armadillo-5.100.2\include\armadillo_bits/diskio_meat.hpp(1626) : see reference to function template instantiation 'bool arma::diskio::convert_naninf<eT>(eT &,const std::string &)' being compiled 
1>   with 
1>   [ 
1>    eT=arma::u32 
1>   ] 
1>   c:\users\haixun\desktop\test_programs\testingapplication\armadillo-5.100.2\include\armadillo_bits/diskio_meat.hpp(1652) : see reference to function template instantiation 'bool arma::diskio::load_arma_ascii<arma::u32>(arma::Mat<arma::u32> &,std::istream &,std::string &)' being compiled 
1>   c:\users\haixun\desktop\test_programs\testingapplication\armadillo-5.100.2\include\armadillo_bits/diskio_meat.hpp(1571) : see reference to function template instantiation 'bool arma::diskio::load_arma_ascii<double>(arma::Mat<double> &,std::istream &,std::string &)' being compiled 
1>   c:\users\haixun\desktop\test_programs\testingapplication\armadillo-5.100.2\include\armadillo_bits/Mat_meat.hpp(6553) : see reference to function template instantiation 'bool arma::diskio::load_arma_ascii<double>(arma::Mat<double> &,const std::string &,std::string &)' being compiled 
1>   c:\users\haixun\desktop\test_programs\testingapplication\armadillo-5.100.2\include\armadillo_bits/Mat_meat.hpp(6536) : while compiling class template member function 'bool arma::Mat<double>::load(const std::string,const arma::file_type,const bool)' 
1>   Source.cpp(50) : see reference to function template instantiation 'bool arma::Mat<double>::load(const std::string,const arma::file_type,const bool)' being compiled 
1>   c:\users\haixun\desktop\test_programs\testingapplication\armadillo-5.100.2\include\armadillo_bits/typedef_mat_fixed.hpp(41) : see reference to class template instantiation 'arma::Mat<double>' being compiled 
1>c:\users\haixun\desktop\test_programs\testingapplication\armadillo-5.100.2\include\armadillo_bits/diskio_meat.hpp(794): error C4146: unary minus operator applied to unsigned type, result still unsigned 
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== 
+0

這看起來像是Visual Studio中的一個錯誤。嘗試更新版本的犰狳。 – mtall

回答

0

對不起,有人低估了你的問題;這對我來說似乎是合理的。

這些警告在這種情況下是無害的。您必須打開該選項才能將警告視爲錯誤。您的選項似乎爲:

  1. 關閉該選項可將警告視爲錯誤。
  2. 關閉該特定警告(項目範圍)。
  3. 無論何時您關閉該特定警告#include <armadillo>

選項3可能是最好的,尤其是如果警告作爲錯誤選項是公司政策。確保推送並彈出警告選項;見this MSDN page on warning pragmas。你可以把所有的東西(編譯指示和包含)放到一個小的頭文件中,無論如何這可能是一個好主意,因爲Visual Studio不會自動完成#include <armadillo>(因爲它沒有文件擴展名)。

相關問題