2015-05-23 29 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>(因为它没有文件扩展名)。

相关问题