2013-03-08 106 views
2

当我尝试用gli/gli.hpp编译时,出现错误。我从来没有碰过这些文件。所以我不知道如何解决这个问题。编译时出现OpenGL GLI错误

In file included from /usr/include/gli/gli.hpp:42:0, 
       from window.cpp:4: 
/usr/include/gli/./core/storage.hpp:89:25: error: declaration of ‘gli::storage::format_type gli::storage::format() const’ [-fpermissive] 
/usr/include/gli/./core/format.hpp:36:8: error: changes meaning of ‘format’ from ‘enum gli::format’ [-fpermissive] 

In file included from /usr/include/gli/gli.hpp:45:0, 
       from window.cpp:4: 
/usr/include/gli/./core/texture2d.hpp:71:24: error: declaration of ‘gli::texture2D::format_type gli::texture2D::format() const’ [-fpermissive] 
/usr/include/gli/./core/format.hpp:36:8: error: changes meaning of ‘format’ from ‘enum gli::format’ [-fpermissive] 

In file included from /usr/include/gli/gli.hpp:46:0 
      from window.cpp:4: 
/usr/include/gli/./core/texture2d_array.hpp:72:24: error: declaration of ‘gli::texture2DArray::format_type gli::texture2DArray::format() const’ [-fpermissive] 
/usr/include/gli/./core/format.hpp:36:8: error: changes meaning of ‘format’ from ‘enum gli::format’ [-fpermissive] 

In file included from /usr/include/gli/gli.hpp:47:0, 
      from window.cpp:4: 
/usr/include/gli/./core/texture3d.hpp:71:24: error: declaration of ‘gli::texture3D::format_type gli::texture3D::format() const’ [-fpermissive] 
/usr/include/gli/./core/format.hpp:36:8: error: changes meaning of ‘format’ from ‘enum gli::format’ [-fpermissive] 

In file included from /usr/include/gli/gli.hpp:51:0, 
      from window.cpp:4: 
/usr/include/gli/./core/load_dds.hpp:37:3: error: ‘string’ is not a member of ‘std’ 

In file included from /usr/include/gli/./core/load_dds.hpp:41:0, 
      from /usr/include/gli/gli.hpp:51, 
      from window.cpp:4: 
/usr/include/gli/./core/load_dds.inl: In function ‘gli::storage gli::loadStorageDDS(const string&)’: 
/usr/include/gli/./core/load_dds.inl:303:1: error: ‘gli::storage gli::loadStorageDDS(const string&)’ redeclared as different kind of symbol 
/usr/include/gli/./core/load_dds.hpp:36:10: error: previous declaration of ‘gli::storage gli::loadStorageDDS’ 

回答

0

我认为问题在于你没有告诉你的编译器你需要使用C++ 11标准进行编译。

如果你正在使用gcc,那么你必须在命令行上传递

-std=c++11 

(或-std = C++ 0x中,如果你使用gcc的旧版本)

0

简而言之,您的C++编译器比用于开发gli的编译器更为严格。仔细检查错误,可以在g++行上添加-fpermissive,使第一个可以被禁止(不一定是正确的)。这个错误看起来像来自使用了错误的返回类型上gli::storage::format()

In file included from /usr/include/gli/gli.hpp:42:0, 
       from window.cpp:4: 
/usr/include/gli/./core/storage.hpp:89:25: error: declaration of ‘gli::storage::format_type gli::storage::format() const’ [-fpermissive] 
/usr/include/gli/./core/format.hpp:36:8: error: changes meaning of ‘format’ from ‘enum gli::format’ [-fpermissive] 

In file included from /usr/include/gli/gli.hpp:45:0, 
       from window.cpp:4: 
/usr/include/gli/./core/texture2d.hpp:71:24: error: declaration of ‘gli::texture2D::format_type gli::texture2D::format() const’ [-fpermissive] 
/usr/include/gli/./core/format.hpp:36:8: error: changes meaning of ‘format’ from ‘enum gli::format’ [-fpermissive] 

In file included from /usr/include/gli/gli.hpp:46:0 
      from window.cpp:4: 
/usr/include/gli/./core/texture2d_array.hpp:72:24: error: declaration of ‘gli::texture2DArray::format_type gli::texture2DArray::format() const’ [-fpermissive] 
/usr/include/gli/./core/format.hpp:36:8: error: changes meaning of ‘format’ from ‘enum gli::format’ [-fpermissive] 

In file included from /usr/include/gli/gli.hpp:47:0, 
      from window.cpp:4: 
/usr/include/gli/./core/texture3d.hpp:71:24: error: declaration of ‘gli::texture3D::format_type gli::texture3D::format() const’ [-fpermissive] 
/usr/include/gli/./core/format.hpp:36:8: error: changes meaning of ‘format’ from ‘enum gli::format’ [-fpermissive] 

以下错误似乎是被包含错误的头文件的情况。特别地,load_dds.hpp包括另一个头文件(storage.hpp),其包括<cstring>,而不是<string>,这是C++声明std::string的地方。快速修复是在您下载的副本中将<string>添加到storage.hpp中,并提交一个错误。

In file included from /usr/include/gli/gli.hpp:51:0, 
      from window.cpp:4: 
/usr/include/gli/./core/load_dds.hpp:37:3: error: ‘string’ is not a member of ‘std’ 

对于这一块,我认为问题是,在load_dds.hppgli::loadStorageDDS被delcared作为函数,但未标记为inline,在那里,这就是在load_dds.inl回事。 .inl机制似乎是Microsoft调制的,因此您可能需要修改.hpp以包含.inl实现以保持一致。 (这是一个猜测,顺便说一句)。

In file included from /usr/include/gli/./core/load_dds.hpp:41:0, 
      from /usr/include/gli/gli.hpp:51, 
      from window.cpp:4: 
/usr/include/gli/./core/load_dds.inl: In function ‘gli::storage gli::loadStorageDDS(const string&)’: 
/usr/include/gli/./core/load_dds.inl:303:1: error: ‘gli::storage gli::loadStorageDDS(const string&)’ redeclared as different kind of symbol 
/usr/include/gli/./core/load_dds.hpp:36:10: error: previous declaration of ‘gli::storage gli::loadStorageDDS’