简体   繁体   English

在Windows平台上使用Armadillo时生成错误

[英]Build error while using Armadillo on Windows platform

I had installed armadillo library on window visual studio 2013. When i attempted to build the solution. 我已经在window visual studio 2013上安装了犰狳库。当我尝试构建解决方案时。 The following build error occurred. 发生以下生成错误。 Any help will be appreciated. 任何帮助将不胜感激。

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 ==========

Sorry that someone downvoted your question; 抱歉,有人拒绝了您的问题; it seems reasonable to me. 对我来说似乎很合理。

These are warnings, which in this particular case are harmless. 这些是警告,在这种情况下是无害的。 You must have the option turned on to treat warnings as errors. 您必须启用该选项才能将警告视为错误。 Your options seem to be: 您的选择似乎是:

  1. Turn off the option to treat warnings as errors. 关闭将警告视为错误的选项。
  2. Turn off that particular warning (project wide). 关闭该特定警告(项目范围)。
  3. Turn off that particular warning whenever you #include <armadillo> . 每当#include <armadillo>时,请关闭该特定警告。

Option 3 is probably best, especially if the warnings as errors option is company policy. 选项3可能是最好的,特别是如果警告作为错误选项是公司政策。 Make sure to push and pop the warning options; 确保按下并弹出警告选项; see this MSDN page on warning pragmas . 请参阅有关警告实用程序的此MSDN页面 You could put the whole lot (pragmas and include) into a little header file, which is probably a good idea anyway since Visual Studio won't autocomplete #include <armadillo> (since it doesn't have a file extension). 您可以将整个文件(pragma和include)放入一个小的头文件中,这可能是个好主意,因为Visual Studio不会自动完成#include <armadillo> (因为它没有文件扩展名)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM