Ancurio / mkxp

Free Software implementation of the Ruby Game Scripting System (RGSS)
GNU General Public License v2.0
532 stars 140 forks source link

Fix: undefined-var-template #212

Closed khiav223577 closed 6 years ago

khiav223577 commented 6 years ago

I encountered this problem when I tried to build mkxp.

make: *** [filesystem.o] Error 1
In file included from src/bitmap.cpp:33:
src/gl-meta.h:57:44: warning: instantiation of variable 'VertexTraits<Vertex>::attr' required here, but no definition is available [-Wundefined-var-template]
        vao.attr      = VertexTraits<VertexType>::attr;
                                                  ^
src/quad.h:79:11: note: in instantiation of function template specialization 'GLMeta::vaoFillInVertexData<Vertex>' requested here
                GLMeta::vaoFillInVertexData<Vertex>(vao);
                        ^
src/vertex.h:65:32: note: forward declaration of template entity is here
        static const VertexAttribute *attr;
                                      ^
src/gl-meta.h:57:44: note: add an explicit instantiation declaration to suppress this warning if 'VertexTraits<Vertex>::attr' is explicitly instantiated in another translation unit
        vao.attr      = VertexTraits<VertexType>::attr;
                                                  ^
2018-11-15 8 02 55

Not sure why, but I managed to fix it by adding a line to define VertexTraits<Vertex>::attr, and it worked for me.

Environment

khiav223577 commented 6 years ago

sorry for selecting a wrong source branch