简体   繁体   English

使用g ++的模板出现编译错误,使用llvm编译正常

[英]Compiliation error with templates using g++, compiles ok with llvm

I really don't know what to make of this. 我真的不知道该怎么做。 I have some code that is being shared on iOS and a Linux server. 我有一些在iOS和Linux服务器上共享的代码。 The iOS LLVM compiler compiles just fine however when I try to compile on Linux with g++ I get many errors. iOS LLVM编译器可以很好地进行编译,但是当我尝试使用g ++在Linux上进行编译时,会遇到很多错误。 The first one being the following: 第一个是:

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

This is line 49: 这是第49行:

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

I do have FloodFillLight.h included in RemoveLight.h so that isn't the problem and my templates are all declared in a .h file. 我确实在RemoveLight.h中包含了FloodFillLight.h,所以这不是问题,我的模板都在.h文件中声明。 I don't have any part of the templates defined in a cpp file. 我没有在cpp文件中定义的模板的任何部分。 Anyone have ideas? 有人有主意吗?

Try preprocessing the file and make sure that FloodFillLight is declared before it's used. 尝试对文件进行预处理,并确保在使用前已声明FloodFillLight。

It might be that a stray #ifdef is muddling up your includes. 可能是#ifdef流浪者混淆了您的包含文件。

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

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