0

モジュール(OpenGLandを使用glm)(単一のプログラムとしてOKをテストおよびコンパイルした)を大きなプログラムに追加すると。プロジェクトでglmをコンパイルするときにエラーが発生しました:

1>d:\program files (x86)\microsoft visual studio 9.0\vc\include\glm\core\type_gentype.hpp(48) : error C2332: “class”: missing tag name
1>d:\program files (x86)\microsoft visual studio 9.0\vc\include\glm\core\type_gentype.hpp(48) : error C2011: “<unnamed-tag>”: “enum” type redefinition
1>        c:\program files\microsoft sdks\windows\v6.0a\include\shlobj.h(3599) : see declaration of '<unnamed-tag>'

私はグーグルを検索し、ここで同様の問題を見つけました。答えは、ヘッダーファイルのシーケンスに問題があると言っていましたが、修正方法がわかりません。

のコード、type_gentype.hppコードはglmにあります。

namespace glm
{
    enum profile
    {
        nice,
        fast,
        simd
    };

namespace detail
{
    template
    <
        typename VALTYPE, 
        template <typename> class TYPE   //**The error indicator pointing at here**
    >
    struct genType
    {
    public:
        enum ctor{null};

        typedef VALTYPE value_type;
        typedef VALTYPE & value_reference;
        typedef VALTYPE * value_pointer;
        typedef VALTYPE const * value_const_pointer;
        typedef TYPE<bool> bool_type;

        typedef sizeType size_type;
        static bool is_vector();
        static bool is_matrix();

        typedef TYPE<VALTYPE> type;
        typedef TYPE<VALTYPE> * pointer;
        typedef TYPE<VALTYPE> const * const_pointer;
        typedef TYPE<VALTYPE> const * const const_pointer_const;
        typedef TYPE<VALTYPE> * const pointer_const;
        typedef TYPE<VALTYPE> & reference;
        typedef TYPE<VALTYPE> const & const_reference;
        typedef TYPE<VALTYPE> const & param_type;

        //////////////////////////////////////
        // Address (Implementation details)

        value_const_pointer value_address() const{return value_pointer(this);}
        value_pointer value_address(){return value_pointer(this);}

    //protected:
    //  enum kind
    //  {
    //      GEN_TYPE,
    //      VEC_TYPE,
    //      MAT_TYPE
    //  };

    //  typedef typename TYPE::kind kind;
    };

    template
    <
        typename VALTYPE, 
        template <typename> class TYPE
    >
    bool genType<VALTYPE, TYPE>::is_vector()
    {
        return true;
    }

enumの再定義部分c:\program files\microsoft sdks\windows\v6.0a\include\shlobj.h(3599)

enum
{   // **The error indicator pointing at here**
    BMICON_LARGE = 0,
    BMICON_SMALL
};

#undef  INTERFACE
#define INTERFACE   IBanneredBar
// the rest of the shlobj.h file
4

1 に答える 1

1

BMICON_LARGEに関しては、これはその名前で事前定義された定数/列挙値がすでに存在するように聞こえます。最善の解決策は、単に別の名前を使用することです。どうしてもその正確な名前が必要な場合は、それを自分の名前空間に入れてください。または、すでに定義されている値を使用することもできます。

于 2012-10-22T13:12:08.110 に答える