当我尝试使用gli / gli.hpp进行编译时,我发现了错误。我以前从未接触过这些文件。所以我不知道如何解决问题。
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 :(得分:0)
简短的回答是,您的C ++编译器比用于开发gli的编译器更严格。通过在-fpermissive
行添加g++
,可以解决第一个错误(无需正确修复)。此错误看起来像是在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.hpp
,gli::loadStorageDDS
被视为一个函数,但没有标记为inline
,这就是load_dds.inl
中发生的事情。 {1}}。 .inl
机制似乎是Microsoft混合的一种,因此您可能需要修改.hpp
以包含.inl
实现以保持一致。 (这是猜测,BTW)。
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’
答案 1 :(得分:0)
我认为问题在于您没有告诉编译器您需要使用C ++ 11标准进行编译。
如果您正在使用gcc,则必须通过
-std=c++11
命令行上的(如果您使用的是旧版本的gcc,则为-std = c ++ 0x)