0

嗨,最近我已经安装了 Libtorch,并且可以在我的新 Visual Studio 项目中使用它而没有问题。目前我正在尝试在现有的 CUDA 项目中使用 Libtorch。但是当我包含火炬头时我遇到了这些奇怪的错误,我在互联网上找不到任何关于我的问题的解决方案。有谁知道这些错误的原因可能是什么?

Severity    Code    Description Project File    Line    Suppression State
Error   C2833   'operator {' is not a recognized operator or type   DepthSensing    e:\research\libtorch\include\c10\util\flat_hash_map.h   1433    
Error   C2059   syntax error: 'newline' DepthSensing    e:\research\libtorch\include\c10\util\flat_hash_map.h   1433    
Error   C2238   unexpected token(s) preceding ';'   DepthSensing    e:\research\libtorch\include\c10\util\flat_hash_map.h   1433    
Error   C2143   syntax error: missing ';' before 'const'    DepthSensing    e:\research\libtorch\include\c10\util\flat_hash_map.h   1433    
Error   C2833   'operator {' is not a recognized operator or type   DepthSensing    e:\research\libtorch\include\c10\util\order_preserving_flat_hash_map.h  1552    
Error   C2059   syntax error: 'newline' DepthSensing    e:\research\libtorch\include\c10\util\order_preserving_flat_hash_map.h  1552    
Error   C2238   unexpected token(s) preceding ';'   DepthSensing    e:\research\libtorch\include\c10\util\order_preserving_flat_hash_map.h  1552    
Error   C2143   syntax error: missing ';' before 'const'    DepthSensing    e:\research\libtorch\include\c10\util\order_preserving_flat_hash_map.h  1552

环境

  • 视窗 10
  • CUDA 10.1
  • 视觉工作室 2017
  • C++14
4

1 回答 1

1

感谢@john,我意识到另一个库中有一个宏,它与 Libtorch 库中的类型名同名(在我的例子中是一个名为V的宏),这就是它在编译时感到困惑的原因。我现在坚持这个解决方案。

警告 C4003:宏“max”的实际参数不足 - Visual Studio 2010 C++

于 2020-04-12T19:31:16.963 回答