简体   繁体   中英

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. The iOS LLVM compiler compiles just fine however when I try to compile on Linux with g++ I get many errors. 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:

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. I don't have any part of the templates defined in a cpp file. Anyone have ideas?

Try preprocessing the file and make sure that FloodFillLight is declared before it's used.

It might be that a stray #ifdef is muddling up your includes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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