我只是尝试使用GCC 4.9测试CodeBlocks 16.01中的Eigen Tensor模块。正如http://eigen.tuxfamily.org/index.php?title=Tensor_support所建议的,我添加了-std = c ++ 0x,-std = c ++ 11或-std = c ++ 1y作为编译器标志,但我无法使其工作。已经
了#include <unsupported/Eigen/CXX11/Tensor>
根据我使用的标志产生错误消息。如果是-std = c ++ 0x或-std = c ++ 11
||=== Build: Debug in Test (compiler: GNU GCC Compiler) ===|
C:\Program Files (x86)\CodeBlocks\eigen-eigen-c2947c341c68\unsupported\Eigen\CXX11\Tensor|52|error: conflicting declaration 'typedef long int int32_t'|
C:\Program Files (x86)\CodeBlocks\MinGW\include\stdint.h|31|note: previous declaration as 'typedef int int32_t'|
C:\Program Files (x86)\CodeBlocks\eigen-eigen-c2947c341c68\unsupported\Eigen\CXX11\Tensor|53|error: conflicting declaration 'typedef long unsigned int uint32_t'|
C:\Program Files (x86)\CodeBlocks\MinGW\include\stdint.h|32|note: previous declaration as 'typedef unsigned int uint32_t'|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|
在-std = c ++ 1y的情况下,我收到了其他错误消息:
||=== Build: Debug in Test (compiler: GNU GCC Compiler) ===|
C:\Program Files (x86)\CodeBlocks\eigen-eigen-c2947c341c68\unsupported\Eigen\CXX11\..\..\..\Eigen\src\Core\util\IntegralConstant.h|187|error: template declaration of 'const Eigen::internal::FixedInt<N> Eigen::fix'|
C:\Program Files (x86)\CodeBlocks\eigen-eigen-c2947c341c68\unsupported\Eigen\CXX11\..\..\..\Eigen\src\Core\util\IndexedViewHelper.h|63|error: 'fix' was not declared in this scope|
C:\Program Files (x86)\CodeBlocks\eigen-eigen-c2947c341c68\unsupported\Eigen\CXX11\..\..\..\Eigen\src\Core\util\IndexedViewHelper.h|63|error: expected primary-expression before ')' token|
C:\Program Files (x86)\CodeBlocks\eigen-eigen-c2947c341c68\unsupported\Eigen\CXX11\..\..\..\Eigen\src\Core\ArithmeticSequence.h|142|error: 'fix' was not declared in this scope|
C:\Program Files (x86)\CodeBlocks\eigen-eigen-c2947c341c68\unsupported\Eigen\CXX11\..\..\..\Eigen\src\Core\ArithmeticSequence.h|142|error: 'fix' was not declared in this scope|
C:\Program Files (x86)\CodeBlocks\eigen-eigen-c2947c341c68\unsupported\Eigen\CXX11\..\..\..\Eigen\src\Core\ArithmeticSequence.h|142|error: expected primary-expression before ')' token|
C:\Program Files (x86)\CodeBlocks\eigen-eigen-c2947c341c68\unsupported\Eigen\CXX11\..\..\..\Eigen\src\Core\ArithmeticSequence.h||In member function 'decltype (Eigen::seqN((((const Eigen::ArithmeticSequence<FirstType, SizeType, IncrType>*)this)->Eigen::ArithmeticSequence<FirstType, SizeType, IncrType>::m_first + ((((((const Eigen::ArithmeticSequence<FirstType, SizeType, IncrType>*)this)->Eigen::ArithmeticSequence<FirstType, SizeType, IncrType>::m_size + <expression error>) < (-1)) > <expression error>) * ((const Eigen::ArithmeticSequence<FirstType, SizeType, IncrType>*)this)->Eigen::ArithmeticSequence<FirstType, SizeType, IncrType>::|
C:\Program Files (x86)\CodeBlocks\eigen-eigen-c2947c341c68\unsupported\Eigen\CXX11\..\..\..\Eigen\src\Core\ArithmeticSequence.h|143|error: 'fix' was not declared in this scope|
C:\Program Files (x86)\CodeBlocks\eigen-eigen-c2947c341c68\unsupported\Eigen\CXX11\..\..\..\Eigen\src\Core\ArithmeticSequence.h|143|error: expected primary-expression before ')' token|
C:\Program Files (x86)\CodeBlocks\eigen-eigen-c2947c341c68\unsupported\Eigen\CXX11\..\..\..\Eigen\src\Core\ArithmeticSequence.h|207|error: 'fix' was not declared in this scope|
C:\Program Files (x86)\CodeBlocks\eigen-eigen-c2947c341c68\unsupported\Eigen\CXX11\..\..\..\Eigen\src\Core\ArithmeticSequence.h|207|error: 'fix' was not declared in this scope|
C:\Program Files (x86)\CodeBlocks\eigen-eigen-c2947c341c68\unsupported\Eigen\CXX11\..\..\..\Eigen\src\Core\ArithmeticSequence.h|207|error: expected primary-expression before ')' token|
C:\Program Files (x86)\CodeBlocks\eigen-eigen-c2947c341c68\unsupported\Eigen\CXX11\..\..\..\Eigen\src\Core\ArithmeticSequence.h||In function 'decltype (Eigen::seqN((typename Eigen::internal::cleanup_index_type<FirstType>::type)(f), (((((typename Eigen::internal::cleanup_index_type<SizeType>::type)(l) - (typename Eigen::internal::cleanup_index_type<FirstType>::type)(f)) + <expression error>) < 1) > <expression error>))) Eigen::seq(FirstType, LastType)':|
C:\Program Files (x86)\CodeBlocks\eigen-eigen-c2947c341c68\unsupported\Eigen\CXX11\..\..\..\Eigen\src\Core\ArithmeticSequence.h|211|error: 'fix' was not declared in this scope|
C:\Program Files (x86)\CodeBlocks\eigen-eigen-c2947c341c68\unsupported\Eigen\CXX11\..\..\..\Eigen\src\Core\ArithmeticSequence.h|211|error: expected primary-expression before ')' token|
C:\Program Files (x86)\CodeBlocks\eigen-eigen-c2947c341c68\unsupported\Eigen\CXX11\Tensor|52|error: conflicting declaration 'typedef long int int32_t'|
C:\Program Files (x86)\CodeBlocks\MinGW\include\stdint.h|31|note: previous declaration as 'typedef int int32_t'|
C:\Program Files (x86)\CodeBlocks\eigen-eigen-c2947c341c68\unsupported\Eigen\CXX11\Tensor|53|error: conflicting declaration 'typedef long unsigned int uint32_t'|
C:\Program Files (x86)\CodeBlocks\MinGW\include\stdint.h|32|note: previous declaration as 'typedef unsigned int uint32_t'|
||=== Build failed: 15 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|
关于我做错了什么或如何解决它的任何想法? 提前致谢
答案 0 :(得分:0)
这可能是因为您的编译器不支持variable template。 从gcc 5开始支持变量模板。
https://www.gnu.org/software/gcc/projects/cxx-status.html
您可以升级编译器或修改本征源代码。