【问题标题】:Compiliation error with templates using g++, compiles ok with llvm使用 g++ 的模板编译错误,使用 llvm 编译正常
【发布时间】:2013-02-06 23:45:22
【问题描述】:

我真的不知道该怎么做。我有一些在 iOS 和 Linux 服务器上共享的代码。 iOS LLVM 编译器编译得很好,但是当我尝试在 Linux 上使用 g++ 编译时,我得到了很多错误。第一个如下:

RemoveLight.h: In member function ‘void RemoveLight<WindowDerived, ChunkDerived, dim>::lightRemoveEditStart()’:
RemoveLight.h:49:17: error: ‘FloodFillLight’ was not declared in this scope
RemoveLight.h:49:45: error: expected primary-expression before ‘,’ token
RemoveLight.h:49:59: error: expected primary-expression before ‘,’ token

这是第 49 行:

FloodFillLight<WindowDerived, ChunkDerived, dim>(x, i, z, target, chunkWindow);

我确实在 RemoveLight.h 中包含了 FloodFillLight.h,所以这不是问题,我的模板都在 .h 文件中声明。我没有在 cpp 文件中定义模板的任何部分。有人有想法吗?

【问题讨论】:

    标签: c++ templates compiler-errors g++


    【解决方案1】:

    尝试预处理文件并确保在使用之前声明了 FloodFillLight。

    可能是一个杂散的#ifdef 混淆了您的包含。

    【讨论】:

      猜你喜欢
      • 2011-07-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-06
      • 2023-03-11
      相关资源
      最近更新 更多