Project in Qt compiles in Ubuntu but does not compile in Windows

1

I have a project for college originally produced on linux platform using Qt Creator and I need to migrate it to windows. I tried to compile but the project has errors in a single header file and I do not understand why.

Some of the errors are included in the attachment:

Followtheclass:

#ifndefPROPERTIES_H#definePROPERTIES_H#include<map>#include<list>#include<string>#include<iostream>#include<stdexcept>classProperties{public:enumDataType{INT,VOID,FLOAT,BOOLEAN,STRING};structProperty{Property(conststd::string&name_,Properties::DataTypetype_):name(name_),type(type_){}conststd::stringname;constProperties::DataTypetype;};Properties(){}Properties(constProperties&prop){*this=prop;}~Properties(){for(DataMap::iteratorit=dataMap.begin();it!=dataMap.end();++it){deleteit->second;}}Properties&operator=(constProperties&prop){for(DataMap::const_iteratorit=prop.dataMap.begin();it!=prop.dataMap.end();++it)dataMap.insert(make_pair(it->first,it->second->getCopy()));return*this;}template<typenameT>Properties&set(conststd::string&name,constT&value){DataMap::const_iteratorit=dataMap.find(name);if(it!=dataMap.end()){BaseDataRec*rec=it->second;if(rec->type==getType<T>())((DataRec<T>*)rec)->data=value;}elsedataMap.insert(make_pair(name,newDataRec<T>(value,getType<T>())));return*this;}boolhas(conststd::string&name)const{DataMap::const_iteratorit=dataMap.find(name);if(it!=dataMap.end())returntrue;returnfalse;}template<typenameT>boolhas(conststd::string&name)const{DataMap::const_iteratorit=dataMap.find(name);if(it!=dataMap.end()){if(it->second->type==getType<T>())returntrue;}returnfalse;}template<typenameT>Tget(conststd::string&name)const{DataMap::const_iteratorit=dataMap.find(name);if(it!=dataMap.end()){BaseDataRec*rec=it->second;if(rec->type==getType<T>())return((DataRec<T>*)rec)->data;elsestd::cout<<"\"" << name << "\" não é do tipo solicitado." << std::endl;
        }
        else
            std::cout << "\"" << name << "\" não encontrado." << std::endl;

        throw std::runtime_error("Erro ao obter o parametro.");
    }

    template<typename T>
    T get(const std::string& name, const T& def) const
    {
        DataMap::const_iterator it = dataMap.find(name);
        if(it != dataMap.end())
        {
            BaseDataRec *rec = it->second;
            if(rec->type == getType<T>())
                return ((DataRec<T>*)rec)->data;
            else
            {
                std::cout << "\"" << name << "\" não é do tipo solicitado." << std::endl;
                throw std::runtime_error("Erro ao obter o parametro.");
            }
        }

        return def;
    }

    std::list<Property> getSummary()
    {
        std::list<Property> result;
        for(DataMap::const_iterator it = dataMap.begin(); it != dataMap.end(); ++it)
            result.push_back(Property(it->first, it->second->type));
        return result;
    }

private:
    struct BaseDataRec
    {
        BaseDataRec(DataType t) :
            type(t)
        {}

        virtual BaseDataRec* getCopy() = 0;

        DataType type;
    };

    template<typename T>
    struct DataRec: public BaseDataRec
    {
        DataRec(const T& d, DataType t) :
            BaseDataRec(t), data(d)
        {}

        virtual DataRec<T>* getCopy()
        { return new DataRec<T>(data, type); }

        T data;
    };

    template<typename T>
    DataType getType() const
    {
        std::cout << "Não há suporte ao tipo solicitado." << std::endl; return VOID;
    }

    typedef std::map<std::string, BaseDataRec*> DataMap;
    DataMap dataMap;
};


#define SUPPORT_TYPE(type, enumtype) \
    template<> \
    inline Properties::DataType Properties::getType<type>() const \
    { return enumtype; }


SUPPORT_TYPE(int, Properties::INT)
SUPPORT_TYPE(float, Properties::FLOAT)
SUPPORT_TYPE(bool, Properties::BOOLEAN)
SUPPORT_TYPE(std::string, Properties::STRING)



#endif // PROPERTIES_H
    
asked by anonymous 20.10.2016 / 20:30

0 answers