c++ - 使用G++的模板的编译错误,使用llvm编译正常

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

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文件中定义的模板的任何部分。有人有想法吗?

最佳答案

尝试对文件进行预处理,并确保在使用前已声明FloodFillLight。

可能是#ifdef Vagrant 混淆了您的包含文件。

https://stackoverflow.com/questions/14741062/

相关文章:

python - AttributeError : 'int' object has no attr

c++ - Qt : Error while compiling Qt 5.0.1 on Windo

android - 我开始 Activity 后,应用程序即被终止

visual-studio-2010 - 使用Microsoft Visual Studio 201

c++ - 编译器错误 : Undefined symbols for architecture x

jquery - Eclipse不了解jQuery

ruby-on-rails - Rails ActionView::Template::Error:

apache - htaccess 将所有页面重定向到单个页面

c++ - 数组下标错误的类型 'int[int]'无效

compiler-errors - 收到此错误LNK2019,不知道为什么