[英]Compiliation error with templates using g++, compiles ok with 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流浪者混淆了您的包含文件。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.