问题描述
我为所在的类提供了一个OpenGL项目,它基于GLUI.提供的GLUI库无法正常工作,这就是我尝试自己编译它的原因.因此,我从SourceForge下载了源代码,并尝试编译_glui库.它给了我这个,我找不到关于它的任何信息:
I've got an OpenGL project for a class I'm in, and it's based on GLUI. The provided GLUI library won't work which is why I'm trying to compile it myself. So, I downloaded the source code from SourceForge and try to compile the _glui library. It gives me this, and I can't find any information on it:
1>ClCompile:
1> algebra3.cpp
1> arcball.cpp
1> glui.cpp
1>c:\users\jake\downloads\glui-2.36\glui-2.36\src\include\gl\glui.h(1718): error C2252: an explicit instantiation of a template can only occur at namespace scope
1>c:\users\jake\downloads\glui-2.36\glui-2.36\src\include\gl\glui.h(1719): error C2252: an explicit instantiation of a template can only occur at namespace scope
1> glui_add_controls.cpp
1>c:\users\jake\downloads\glui-2.36\glui-2.36\src\include\gl\glui.h(1718): error C2252: an explicit instantiation of a template can only occur at namespace scope
1>c:\users\jake\downloads\glui-2.36\glui-2.36\src\include\gl\glui.h(1719): error C2252: an explicit instantiation of a template can only occur at namespace scope
1> glui_bitmap_img_data.cpp
1> glui_bitmaps.cpp
1>c:\users\jake\downloads\glui-2.36\glui-2.36\src\include\gl\glui.h(1718): error C2252: an explicit instantiation of a template can only occur at namespace scope
1>c:\users\jake\downloads\glui-2.36\glui-2.36\src\include\gl\glui.h(1719): error C2252: an explicit instantiation of a template can only occur at namespace scope
1> glui_button.cpp
1>c:\users\jake\downloads\glui-2.36\glui-2.36\src\include\gl\glui.h(1718): error C2252: an explicit instantiation of a template can only occur at namespace scope
1>c:\users\jake\downloads\glui-2.36\glui-2.36\src\include\gl\glui.h(1719): error C2252: an explicit instantiation of a template can only occur at namespace scope
1> glui_checkbox.cpp
1>c:\users\jake\downloads\glui-2.36\glui-2.36\src\include\gl\glui.h(1718): error C2252: an explicit instantiation of a template can only occur at namespace scope
1>c:\users\jake\downloads\glui-2.36\glui-2.36\src\include\gl\glui.h(1719): error C2252: an explicit instantiation of a template can only occur at namespace scope
1> glui_column.cpp
等,等等等等
我看了glui.h源文件,第1718和1719行是这样的:
I look at the glui.h source file, and lines 1718 and 1719 have this:
#ifdef _MSC_VER
// Explicit template instantiation needed for dll
template class GLUIAPI std::allocator<GLUI_String>;
template class GLUIAPI std::vector<GLUI_String, std::allocator<GLUI_String> >;
#endif
有人看过吗?
推荐答案
如果有人有更多信息,我很高兴听到它,但是我发现注释掉glui.h中的这一节可以编译它.现在,我们将了解编译后的库是否真正起作用....
If anyone has more info, I'd be glad to hear it, but I found that commenting out the section in glui.h allows it to compile. Now we'll find out if the compiled library actually works....
这篇关于编译GLUI库,VS2010给了我一个奇怪的名称空间错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!